querying posts based on user locations

made a few changes to @EmilS algorithm so that we can now use it on the web app too

@karanthukral