This question is similar to designing Yelp search functionality based on the GPS location. You are not allowed to use any 3rd party service. I was thinking to design a system which will have 2 schemas. Something like having a 2D grid on the X and Y coordinates. One schema/table will contain longitude and another table will contain latitude.