| Author |
Message |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 26/11/2009 15:15:33
|
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
|
|
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 27/11/2009 06:40:46
|
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
|
 |
|
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 29/11/2009 22:35:04
|
azpublic
Joined: 20/11/2009 02:27:20
Messages: 5
Offline
|
Thanks Marc
This helped me a lot.
|
|
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 15/12/2009 14:31:39
|
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
|
|
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 15/12/2009 14:35:26
|
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
|
|
|
 |
![[Post New]](/gforum/templates/default/images/icon_minipost_new.gif) 15/12/2009 22:37:44
|
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
|
 |
|
|
 |
|
|