4

I'm writing an application that needs to plot a user's location on the map, and the user could be anywhere in the world, but I only need city/town level resolution, not street address. Is there a single open source database that contains this information?

RyanKDalton
  • 23,068
  • 17
  • 110
  • 178
Joshua Frank
  • 195
  • 1
  • 1
  • 4

2 Answers2

5

Since you are interested in city/town level resolution, the best one is geonames.org.

"The GeoNames geographical database covers all countries and contains over eight million placenames that are available for download free of charge."

In case you are interested in your user's IP address, you can use ipinfodb. It returns the location of an IP address (country, region, city, zipcode, latitude and longitude) and the associated timezone in JSON format.

thelastray
  • 2,864
  • 3
  • 24
  • 43
  • Another option for ips is https://ipinfo.io – Ben Dowling Oct 17 '17 at 18:33
  • geonames.org is only useful if you want the nearest city with a population over a given size. If you have a big city near a small city, you're not going to get the city boundary correct by just finding the nearest neighbor. – Luke Hutchison Feb 13 '24 at 08:46
0

For geocoding up to street level, but can also only request a city, this could be useful: http://wiki.openstreetmap.org/wiki/Nominatim

warrieka
  • 3,479
  • 17
  • 18