GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Admin divisions relationships  XML
Forum Index -> Administrative Divisions
Author Message
azpublic



Joined: 20/11/2009 02:27:20
Messages: 5
Offline

Hi !

I wanted to know how I could determine the relationships that features of the database have with their administrative divisions.

There are adm1 to adm4 codes, however I wanted to know how I could correlate these codes with actual features of the database.

For example for "Malibu" I have the admin1 code = "CA" and admin2 code "037" with country code = "US

I would like to determine the geoname unique ID of the entry represented by 037 and the unique geoname ID of the entry represented by CA and finally the geoname entry for "US"

is this possible and how ?

Edit: I am using the database dump.

Thank you!

Cheers,

Alex
marc



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

Alex

You just have to get the entry with the corresponding feature code. For admin1code it is ADM1 etc.

Best

Marc

[WWW]
azpublic



Joined: 20/11/2009 02:27:20
Messages: 5
Offline

Thanks Marc

This helped me a lot.
Claude Warren



Joined: 14/06/2009 16:46:35
Messages: 8
Offline

If I understand this correctly then, an entry for a city might have an admin1 code if there are admin1 codes in the system for the country in which the city resides. To find the admin1 code name I take the country,admin1 combo from the city and look up the record that has that country and admin1 code as well as feature_class='A' and feature_code='ADM1'.

If that is right then so far so good and I can ask my question, which is: Should there be any records where the feature_class='A' and the feature_code='ADM1' and the admin1 fields is empty?

I was doing a referential integrity check on a complete set of data from Dec 8, 2009 and found 79 records ADM1 records that have no admin1 value.

Claude Warren

Identity Info identify.nu

[WWW]
Claude Warren



Joined: 14/06/2009 16:46:35
Messages: 8
Offline

One more question. Are each of the administrative codes supposed to build upon the previous code. Fore example a record might have value2 for country_code, admin1, admin2 and admin3, but you should not find a record that has values for country_code,admin1 and admin3 without admin2 being specified. Is that correct?

as a follow on, each adminX field specified should have a corresponding feature_code='ADMX' record, with the same adminX value constraints specified above. Is that correct?

Claude Warren

Identity Info identify.nu

[WWW]
marc



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

Claude

Your understanding is correct. In reality, however, the constraints are not enforced as we do not have the resource to guarantee it at any time. The choice is between some violations and not loosing and data or loosing data and enforce the constraint. We have opted for the first, as it is easy for a user to delete all offending records and enforce the constraints. The violating records may still be important for other users and the information helps in ultimately fixing the problems.

Best

Marc

[WWW]
 
Forum Index -> Administrative Divisions
Go to:   
Powered by JForum 2.1.5 © JForum Team