I'm having a hard time figuring out how to get parent features. I've got the administrative features figured out but how do you get that Mount Everest(geonameid=1283416) has a parent feature of Nepal (geonameid=128298
I've looked and it's definitely not coming from the hierarchy table which is a table I still don't understand since it seems to mostly duplicate the administrative hierarchy that's available from geonames table with some other random junk in there.
The admin hierarchy is encoded in the countrycode and admincodeXX attributes.
There is a second countrycode column for a coma separated list for features belongig to multiple countries.
The hierarchy file is for other relations, outside of the standard tree like admin hierarchy (such as admin features belonging to more than one parent)
There is a single adm2 division but I can't figure out how to find that. It says it's Burleson which is goenameid 4677551 but that has fclascode P.PPL not ADM2 and there is no entry with country = TX and admin2 = '051'
It can't come from the cc2 column because it's not a country.
12110882 doesn't appear as a child in any entry in the hierarchy table.
This moderated forum really makes it hard to respond or edit previous responses.
I had previously said country = TX, should have been US
So I think I know where it's failing for https://www.geonames.org/12110882/mountain-states.html is has adm2 as Burleson, that's Burleson County 4677558, and the reason it wasn't joining is that mountain states has a null for adm1 and burleson county has TX.
Now I'll have to figure out how this works if the previous admin entry is null.
So after looking at it I'm really not sure how you're supposted to find the adm2 if the adm1 is null. Adm2 isn't unique within a hierarchy. You can have multiple adm1's for any given adm2. There are 36 adm2's (051). How did you figure out that 12110882's was the one in TX?
For 12110882 it was simply a data error. I have just fixed it and set the adm2 code to null. It does not make sense for a region spanning severl states to have the adm2 code set.
If you want to know the counties within this region then you have to find all states from the hierarchy table and from the states you find the counties for these states.