[Geocoding] Nominatim: Listing all streets in city
Glenn Plas
glenn at byte-consult.be
Tue May 28 07:41:20 UTC 2013
>> When I see a question like this, I immediately think : Overpass API
>> , see http://wiki.openstreetmap.org/wiki/Overpass_API
>
> Um, I think it would be more useful to have a specific example of
> using the Overpass API for this. It's not obvious from the link you
> gave, unless I'm skimming through it too quickly. Sarah's response was
> specific and far more useful!
>
I don't really believe in spoon feeding solutions, but rather point to
places so you can help yourself, next time you have a similar problem,
you save time and save yourself. So, it sounded like you are asking :
please solve my problem for me ...
That being said, that page IS confusing to learn about Overpass API,
perhaps you could try a frontend on it like http://overpass-turbo.eu/
that would help seeing and trying some examples. I was just bringing
it to your attention that there is an API that is specifically designed
to extract small or large filtered datasets.
But unless someone like Sarah has something lying around that could
match your problem, you will not going to get a lot of prechewed
solutions from others.
When I asked in the past: How can I find all bread vending machine in a
country, someone pointed me to the overpass API and I helped myself.
You just need to play with it, it's very powerful, hence a steep
learning curve at first. Personally the path to find a solution is as
interesting to me as the solution itself.
You can use overpass api to download the whole city. You should first
find id of the relation which defines the city (you can query for it via
overpass api if you do not have it in your system already). For example
Vuppertal has 62478. Then add 3600000000 to the id and send and send the
following POST request to http://www.overpass-api.de:
<union>
<area-query ref="3600062478"/>
<recurse type="node-relation" into="rels"/>
<recurse type="node-way"/>
<recurse type="way-relation"/>
</union>
<print mode="body"/>
To find the city relation send the following POST request to
http://overpass-api.de/api/interpreter
<query type="relation">
<has-kv k="name" v="Wuppertal"/>
<has-kv k="type" v="boundary"/>
</query>
<print mode="body"/>
if you want to be more restrictive you may add more filters like
de:place=city if you are only looking at Germany or admin_level=
something etc. If you want to get more results, you can only use the name:
<query type="relation">
<has-kv k="name" v="Wuppertal"/>
</query>
<print mode="body"/>
it is up to you, what do you consider "a city". I almost totally ripped
this off from a few stackoverflow answers which I googled for you in 5
seconds...
Glenn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/geocoding/attachments/20130528/aa8d1197/attachment.html>
More information about the Geocoding
mailing list