GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Browsable city names, grouped by sub divisions?  XML
Forum Index -> General
Author Message
ajmas



Joined: 09/02/2009 01:01:21
Messages: 18
Offline

I want to be able to make a browsable list of cities, grouped together by their relevant administrative divisions, where applicable. I also want to make it so that the URL can represent a logical grouping. For example:

/ca
/usa
/uk
/ca/ontario/
/ca/ontario/ottawa
/uk/devon/seaton

Each time the user types in a component to the path he would be presented with the appropriate children. When appropriate I mean in some cases the children of a country are 'admin1', such as for the USA and Canada and in other cases, such as the UK it would be 'admin2'. The idea is to be able to generate something equivalent to the display seen as Kijiji (http://www.kijiji.com/), but automatically.

So far I have written code to do some of this, but I don't yet have any suitable logic for deciding what users expect to see as a geoname grouping. I might simply define a configuration file that would show the order. For example:

Canada=CC/ADMIN1/CITY
UK=CC/ADMIN2/CITY
USA=CC/ADMIN1/CITY

Does anyone have any suggestions as to the best way to go about implementing what I am wanting to do?

I could probably cheat and simply add the Geoname id at the end, but I would like to see if there is a good way of representing the tree as a path.

Additionally, is there any easy way to find the children/parent of a given entry? I don't see any appropriate fields, so imagine I would need to asume country -> adm1 -> adm2 -> adm3 -> city?
marc



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

there is no general rule how to do this. It depends on the number of cities you want to display for each region. In any case don't forget that place names are not unique and the url built with the name is not necessarily unique, it may also change over time.

Best

Marc

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