I want to get the polygon of a given street using OverPass API. When I use, for instance,
(
way
["name"="Hörnesgasse"];
>;
);node(w);
out body;
Here is a Overpass Turbo link: Overpass Turbo
I get the nodes for a polygon, but they are not in the right order. So I can't save them as a line. Is there any possibility to this better?
Another issue I'm having is that I want to restrict the search for a given city, example "addr:city"="Vienna"
. Since the nodes don't have a city attribute directly, how could I write a query to get this information?
You will need the way in order to retrieve the order of nodes. This can't work otherwise, imagine a way including one or more nodes twice.
Remove the node(w);
part from your query and take a look at the <way>
elements. If there are multiple <way>
elements then you will have to determine the correct order of them, too. Consecutive ways will share the same node ID at the start or the end.