This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

I need to fetch the lat and long of road segments for which names (street names) are missing? How can i fetch it using OSM Overpass API?

0

I need to fetch the lat and long of road segments for which names (street names) are missing? How can i fetch it using OSM Overpass API? I tried to tweak a code i already had but it didn't yield any result, the code i used is below

<osm-script output="json" timeout="200"> <id-query {{nominatimarea:washington}}="" into="Area"/> <union> <query type="node"> <has-kv k="highway" v="*"/> <has-kv k="name" v=""/> <area-query from="Area"/> </query> <query type="way"> <has-kv k="highway" v="*"/> <has-kv k="name" v=""/> <area-query from="Area"/> </query> <query type="relation"> <has-kv k="highway" v="*"/> <has-kv k="name" v=""/> <area-query from="Area"/> </query> </union> <union> <item/> <recurse type="down"/> </union> <print mode="body"/> </osm-script>

asked 03 Sep '18, 14:06

Phaneshwar's gravatar image

Phaneshwar
6112
accept rate: 0%


One Answer:

1

Here's the script I use to find unnamed residential highways:

[bbox:{{bbox}}];
way[highway=residential][!name];
out center;

I don't know the xml language but I think you may need to use regex negation to check for missing keys, https://wiki.openstreetmap.org/wiki/Overpass_API/Language_Guide#Negation

I use out center; because it works better for large areas in Overpass Turbo.

answered 03 Sep '18, 15:25

maxerickson's gravatar image

maxerickson
12.7k1083176
accept rate: 32%

Thanks Max but when i replaced the bbox with actual area name and tried overpass turbo gaveup for memory reasons. can you suggest a more optimzed way i can pull all the roads (not just residential) for a particular area along with lat and long of the segment? thank you again for your help!

(03 Sep '18, 15:38) Phaneshwar

I doubt the public Overpass instance will work for a large region, especially if you start including service roads and the like. I use that query to clean up Tiger data and there will often be many thousands of unnamed residentials in just part of a state.

Using a pbf extract and osmconvert/osmfilter is probably the simplest way to go.

(03 Sep '18, 15:45) maxerickson

you should at least exclude anything with noname=yes, assuming you actually want roads without a name that perhaps should have one.

(03 Sep '18, 16:07) SimonPoole ♦

Source code available on GitHub .