4

I downloaded these databases for US and CA from GeoNames. The date looks like this:

5881639 100 Mile House  100 Mile House      51.64982    -121.28594  P   PPL CA      02              0       917 America/Vancouver   2006-01-18
5881640 101 Mile Lake   101 Mile Lake       51.66652    -121.30264  H   LK  CA      02              0       917 America/Vancouver   2006-01-18
5881641 101 Ponds   101 Ponds       47.811  -53.97733   H   PNDS    CA      05              0       18  America/St_Johns    2006-01-18

I want to use this data for a city-picker, but I want to display to province or state beside it. Doesn't look like this data contains that information. Is there some way to retrieve that? Or is there a better DB that includes that?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
mpen
  • 272,448
  • 266
  • 850
  • 1,236

2 Answers2

4

You use the data in the columns for the admin codes these are actually ids that link to the admin codes table (there are separate data sets available for the admin codes) it is very straightforward.

Check the Geonames forums for more info.

http://forum.geonames.org/

nixon
  • 1,952
  • 5
  • 21
  • 41
  • See the data dump on the Geonames download server: [admin1CodesASCII.txt](http://download.geonames.org/export/dump/admin1CodesASCII.txt) – Stijn de Witt May 30 '16 at 08:38
1

Use the datasets here: geocoder.ca which include city name and state / province name in the same file.

If you want to stick with your data, you can use Google's Geocoding API, as in the first answer here:

Google Maps: how to get country, state/province/region, city given a lat/long value?

to get information based on latitude and longitude. This will be a lot of work, though, especially for a city-picker.

Community
  • 1
  • 1
Andy Mikula
  • 16,796
  • 4
  • 32
  • 39
  • Hey ajm. Do you know what is up with the coordinates? They have for Vancouver 49.25398 123.1081 but when I "Google Map" this I land up on Mongolia. They did not put a Negative(-) sign in front of 123.1081. – chobo2 May 10 '13 at 21:49