2

I am developing an Android application that uses the geonames.org database. I only use the city/populated place category and their corresponding coordinates as provided by geonames.

I want the user to be able to provide his/her GPS coordinates and get a result back with the closest cities/populated places and their coordinates.

Even if the user is in a city I want that city's coordinates to be displayed along with the more distant ones.

Can this be done without the help of google or a web service? I might host the world city geolocations on my own server.

Thanks!

Karl
  • 517
  • 7
  • 18

1 Answers1

1

Since posting this I have found the answer to my own question. MongoDB supports geospatial indexing. Make sure that the longitude and latitude field is saved in one string and point the geospatial index to your loc: field. You can then perform queries with a bounding box to find closest locations within a certain radius for example. More about MongoDB geospatial indexing can be found here: http://www.mongodb.org/display/DOCS/Geospatial+Indexing

Karl
  • 517
  • 7
  • 18