[talk-ph] export current place names and relation

Mike Collinson mike at ayeltd.biz
Fri Mar 20 10:26:38 GMT 2009


At 07:01 AM 20/03/2009, Ronny Ager-Wick - Develo Ltd. wrote:
>Hi, I was wondering, to prepare for the postcode and place name
>database, is it possible to export from OSM a list of the place names we
>currently have, what they are (city, town/municipality, province, etc.),
>and where they are (what province a town is in, etc.)?

Ronny,

You may be able to piggy-back on some work I have been doing to do just that.

The easiest way to systematically get out lists of states, cities, towns, islands, ... etc within the Philippines is to use OSM XAPI

http://wiki.openstreetmap.org/wiki/Xapi

Here is a command that you can paste in your browser to try.  It should give you back every city in the Philippines by using a lat/lon bounding box.  I've calculated the bounding box from GNS data. It should be accurate but there are sometimes spurious values that make it too big.

http://xapi.openstreetmap.org/api/0.5/node[place=city][bbox=116.65,4.588889,126.604444,21.113056]

You can then use place=state, place=island ... to pull out other lists.

I hope you can use XML data. If not, there are other options like Osmosis http://wiki.openstreetmap.org/wiki/Osmosis, but I am not very familiar with them.

 From the sample below, you will see that I have tried to be systematic using is_in:* tags (is_in:country, is_in:state mostly).  This will not give you an absolutely complete "where they are" picture as some folks will have added data without these tags. But it should give you a good start.


Good luck and if there is any other help I can give, I am always lurking on this list!
Mike



<?xml version='1.0' standalone='no'?>
<osm version='0.5' generator='osmxapi: OSM Extended API' xmlns:osmxapi='http://www.informationfreeway.org/osmxapi/0.5' osmxapi:uri='/api/0.5/node[place=city][bbox=116.65,4.588889,126.604444,21.113056]' osmxapi:planetDate='200903201005' osmxapi:copyright='2008 OpenStreetMap contributors' osmxapi:instance='zappyFafnir'>
  <node id='317949136' lat='18.1948661' lon='120.5934722' user='axk' osmxapi:users='ed_waypointsdotph,axk' timestamp='2009-01-28T17:58:49Z'>
    <tag k='is_in:country' v='Philippines'/>
    <tag k='is_in:country_code' v='ph'/>
    <tag k='is_in:state' v='Province of Ilocos Norte'/>
    <tag k='name' v='Laoag City'/>
    <tag k='place' v='city'/>
  </node>
  <node id='317949374' lat='16.4137024' lon='120.5914918' user='axk' osmxapi:users='ed_waypointsdotph,axk' timestamp='2009-01-28T17:58:46Z'>
    <tag k='is_in:country' v='Philippines'/>
    <tag k='is_in:country_code' v='ph'/>
    <tag k='is_in:state' v='Province of Benguet'/>
    <tag k='name' v='Baguio City'/>
    <tag k='place' v='city'/>
  </node>
</osm> 






More information about the talk-ph mailing list