[OSM-talk] Reverse look-up gazetteer

andrzej zaborowski balrogg at gmail.com
Thu Mar 19 14:06:53 GMT 2009


2009/3/19  <marcus.wolschon at googlemail.com>:
> On Thu, 19 Mar 2009 14:09:21 +0100, andrzej zaborowski <balrogg at gmail.com>
> wrote:
>> 2009/3/19 paul youlten <paul at yellowikis.org>:
>>> Does anyone know if there is there a web service that lets me take the
>>> latitude and longitude of a node and establish which country,
>>> state/county/province, city and Zip/post code the node is in?
>>
>> I don't know of a specific web service but it turns out using the
>> usual API you can find the city name quite easily, I first saw it done
>> in the party render script:
>> http://svn.openstreetmap.org/applications/rendering/party/render.py .
>> The post code and other data you would have to pull from somewhere
>> else as OSM doesn't store those except for a few places now.
>
> Hello Andrezej,
>
> I read the source-code and it just looks for a node with a place-tag
> exists in a certain bounding box, expecting to find exactly one.

Yes, in practice that simple way turned out to work very well for me.

>
> This will fail if:
> * there are more then 1 place-nodes in the bounding box

Why not automatically choose the closest place.

> * the city is too large the the node is not in the bounding-box
> * the location does not belong to the city but the center of some village
> is nearby

Yes, then again with any such "reverse gazeteer" you need to choose an
arbitrary distance to decide what point is "in the city" and what is
outside.  Some localities have an associated landuse=residential.

> * the location is part of a place=hamlet or anything but "city", "village"
> or "town"

I didn't say you should literally use the party render code, obviously
it's an example.
I don't know what use Paul has for this service but it doesn't seem
like separate web service is justified (thought it might be, and if
there is one already, with zip codes etc...).

Regards




More information about the talk mailing list