GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Obtain the hierarchy from the database dump  XML
Forum Index -> FAQ - frequently asked questions
Author Message
JakobE



Joined: 04/04/2015 00:00:57
Messages: 3
Offline

Hello I downloaded the database dump from here:
http://download.geonames.org/export/dump/

Especially the hierarchy.zip file has been downloaded.

Unfortunately I am not able to obtain the hierarchy for the following geo-id: 2873759 but your webservice is. The downloaded dump does not contain an entry for the given id as child-id.

http://api.geonames.org/hierarchy?geonameId=2873759&username=demo[b]

How can I get the same hierarchy as the webservice produces, or at lest the parent of my geo-area?
marc



Joined: 08/12/2005 07:39:47
Messages: 3992
Offline

Hi Jakob

The admin hierarchy is encoded in the adminX structure of the gazetteer file (allCountries.txt). You combine the countrycode and all available admin codes to find the entry in the dame table with the feature type ADMx and the same combination of codes.
Example you have countrycode XX and admincode1 01 then you search for a feature with feature code ADM1 and countrycode=XX and admincode1='01', this is the highest admin division, then you do the same for the ADM2 as a combination of countrycode, admincode1 and admincode2, etc till you have used all admX codes filled out for your feature. Normally you may want to fill a table with the entire hierarchy info encoded in the admX codes.

Regards

Marc

[WWW]
 
Forum Index -> FAQ - frequently asked questions
Go to:   
Powered by JForum 2.1.5 © JForum Team