[SOLVED] [Overpass] Right way to retrieve one-way streets?

Hello,

I’m not sure of the right way to query OSM through OverpassTurbo to retrieve one-way streets:

[out:json][timeout:25];

area["name"="MyCityName"]->.searchArea;

(
  way["highway"="oneway"](area.searchArea);
);

out body;
>;
out skel qt;

OR

[out:json][timeout:25];

{{geocodeArea:"MyCityName"}}->.a;

(
  way["oneway"="yes"](area.a);
);

out body;
>;
out skel qt;

Or are area[] and geocodeArea similar, and the important part is mixing “highway” and “oneway”?

Also, in case other cities in the world have the same name, what is a sure-fire way to avoid confusion?

Thank you.

I would suggest the following, an extension of variant 2.


[out:json][timeout:25];

{{geocodeArea:"MyCityName"}}->.a;

way[highway]["oneway"="yes"](area.a);

out geom;

Variant 1 makes no sense, as highway=oneway is no valid tagging.

{{geocodeArea:“MyCityName”}} is syntactic sugar as defined by overpass turbo. It will get replaced by area( … some number… ) before the query is sent to Overpass API. See http://wiki.openstreetmap.org/wiki/Overpass_turbo/Extended_Overpass_Turbo_Queries which explains replacement rules applied by overpass turbo.

Keep in mind that key “oneway” is also found with value “-1”, which is one way in the reverse direction of the way;
and that for several types of highway (e.g. “motorway”) there is no need for the “oneway” key, as the one-way-ness is their default.

Thanks much.

Actually, the query doesn’t work as expected because there are other cities with the same name.

After looking up the relation number assigned to the city I’d like to check, this query returns nothing:


[out:json][timeout:25];

//BAD {{geocodeArea:"MyCityName"}}->.a;
area(123456)->.a;

way[highway]["oneway"="yes"](area.a);

out geom;

I didn’t find an example in QL (not XML).


Edit: Found it


[out:json][timeout:25];

rel(123456);map_to_area -> .searchArea;

way[highway]["oneway"="yes"](area.searchArea);

out geom;

Out of curiosity, is there a way in Overpass to turn ways into nodes in the output, so that I end up with a bunch of nodes/POIs instead that I can check and delete when I’m out mapping an area ?

Edit: Simple, just use “out center;”.