GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
How can i get Hierarchy of places  XML
Forum Index -> FAQ - frequently asked questions
Author Message
wasem_aslam



Joined: 04/04/2008 19:05:08
Messages: 8
Offline

I need hierarchy of places like Country-province-city-town

Which type of hierarchy these data provide us?I have download the file allCountries.txt so i want to know how can i get "partof" relation.
If we take example of any town T then can we get parent of T which is city C and then also can we get parent of C which is province or country using this file?
I want to create a classification hierarchy of places like geotree.But i am confused that how can i get this?

I am very thankful if you reply!
geotree


[Avatar]
Joined: 23/07/2007 18:28:40
Messages: 138
Location: France
Offline

GeoTree is using the GeoNames hierarchical webservices:
http://www.geonames.org/export/place-hierarchy.html

Christophe
geotree.geonames.org
geotree.geonames.org/geotree.html
[WWW]
marc



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

If you want to do it with the dump you will have to look at the columns countrycode, and admincode1 to admincode4. The respective administrative division have the featurecode ADM1 to ADM4, or PCLI for the countries.


Marc

[WWW]
wasem_aslam



Joined: 04/04/2008 19:05:08
Messages: 8
Offline

ok thanks.I know that if in the file "allCountries.txt" hierarchy exist.Like country code-Admin code1-Admin code 2-Admin3-Admin4..
But i dont understand what actually these codes provides.Mean if i take one feature any place name then can i get the parent of tht place using these codes?
Actualy i need hierarchy pf places.

like i ask one place forexample town then how can i get the city,province,state of selected place?I know about country that we can get the country of any feature.but question is if we can then how can we get city,province,state etc of selected feature.

Thanks so much for answer!
marc



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

Wasem

The file allCountries is self referencing. You can extract hierarchy from the file, but you will have to understand the meaning of the feature codes :
http://www.geonames.org/export/codes.html

Marc

[WWW]
saardaniel



Joined: 07/05/2008 13:10:53
Messages: 3
Offline

hi alle,

I want to this also.
I want found the Adm1 for any given Koordiantes of the word.

If I use the webservice I first look for a nearby place and get the GeoID.
For that GeoID I take the hierarchy-service and get a XML File.
Then I use regulare expresions and search the adm1-code.

Are all information also in the Zip-data I can download here?

Yours,
Daniel
marc



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

saardaniel wrote:
I want found the Adm1 for any given Koordiantes of the word. 


This is the countrySubdiv service :
http://www.geonames.org/export/web-services.html#countrysubdiv


Marc

[WWW]
saardaniel



Joined: 07/05/2008 13:10:53
Messages: 3
Offline

hm...
if I download the GB_Zip I get a List with ADM1 regions in England.
If I use the service e.g. NearBYPlace (eg Bath) and take then the parents I get the ADM1 England.

Wy I didnts get first the Adm2 Level in the parentlist ?
Wy the Adm1 Subdevision-File for GB contains not only Scottland, england and Wales ?

yours,
Daniel

saardaniel



Joined: 07/05/2008 13:10:53
Messages: 3
Offline

oh, wonderful service
Sometimes I get the german "Niedersachsen" sometimes the english "
Lower Saxony". For develop software is'nt really god.


<geoname>
<name>Germany</name>
<lat>51.5</lat>
<lng>10.5</lng>
<geonameId>2921044</geonameId>
<countryCode>DE</countryCode>
<countryName>Germany</countryName>
<fcl>A</fcl>
<fcode>PCLI</fcode>
</geoname>

<geoname>
<name>Lower Saxony</name>
<lat>52.0</lat>
<lng>10.0</lng>
<geonameId>2862926</geonameId>
<countryCode>DE</countryCode>
<countryName>Germany</countryName>
<fcl>A</fcl>
<fcode>ADM1</fcode>
</geoname>

<geoname>
<name>Schwerinsdorf</name>
<lat>53.3166667</lat>
<lng>7.6833333</lng>
<geonameId>2834271</geonameId>
<countryCode>DE</countryCode>
<countryName>Germany</countryName>
<fcl>P</fcl>
<fcode>PPL</fcode>
</geoname>
</geonames>

yours,
daniel
marc



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

Daniel

1. I have "Bath and North East Somerset" as adm2 for Bath :http://ws.geonames.org/hierarchy?geonameId=2656173&style=full
2. There are two files for adm1 names. The admin1Codes.txt file contains obsolete records, as some users have asked for it.
3. The main name is not yet translated, only its admin name and country name are translated according to the language codes passed with the 'lang' parameter : http://forum.geonames.org/gforum/posts/list/881.page

Best

Marc

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