I am trying to use OverPassApi to get a road Geopoints of Major/Minor roads in USA.

Here is the query

<osm-script output="json">
  <id-query {{nominatimArea:USA}} into="area"/>
  <query type="way">
  <has-kv k="highway" regv="motorway|trunk|primary|motorway_link|trunk_link|primary_link"/>
<has-kv k="name" regv="West Side Highway"/>
      <area-query from="area"/>
    <item />
      <recurse type="way-node"/>   
  <print mode="body" order="quadtile"/>

I am successfully trying it on http://overpass-turbo.eu. With few exceptions, in general this query is ok. If anyone can make it better it would be helpful.

My question is, I want to convert it to OverPass QL Using


It gives error at

<id-query {{nominatimArea:USA}} into="area"/>

How can i solve this. Secondly, If i remove this line, and try to run the same coverted code QL on query

NSString *urlString = @"http://overpass-api.de/api/interpreter?data=[out:json];way[\"highway\"~\"motorway|trunk|primary|motorway_link|trunk_link|primary_link\"][\"name\"~\"%@\"](area.area);(._;node(w););out body qt;";

%@ = West Side Highway

it is giving me Empty Array.

What is wrong?

1 Answer 1


{{nominatimArea}} is the old name for {{geocodeArea}} which in turn is a query extension provided by overpass-turbo and not supported by Overpass API directly. If you want to perform this query with Overpass API then you have to replace it with the actual area ID.

Note that overpass turbo is able to convert this query to an Overpass API compatible query (either in XML or QL) via the Export button.

Your overpass-turbo query in question

<id-query {{nominatimArea:USA}} into="area"/>

will be converted to the Overpass-API compatible XML query

<id-query into="area" ref="3600148838" type="area"/>

or the QL query

  • Ok thanks, that was very very helpful. However can you look at query again and tell me if its ok to find out any road in USA and get its geo points or it needs to be improved a little more. Dec 12, 2014 at 14:52
  • That depends what you would consider a primary road. Take a look at this table for deciding whether you want to include secondary and maybe tertiary, too. Otherwise it looks OK to me, however I'm not an Overpass expert :)
    – scai
    Dec 12, 2014 at 15:05
  • 1
    Don't forget that the ref id 3600148838 doesn't have to be stable over time. It just corresponds to the OSM relation 148838 at the time you've executed the query. You may be better off with something like area["ISO3166-1"="US"][boundary=administrative]->.area
    – mmd
    Jan 1, 2015 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.