I want to use overpass to show major highways for a US city. How can I query that from overpass turbo?

I tried the following code here and it returns tons of dots. I really want only lines showing the major highways

This has been generated by the overpass-turbo wizard.
The original search was:
<osm-script output="json" timeout="25">
  <!-- gather results -->
    <!-- query part for: “highway” -->
    <query type="way">
      <has-kv k="highway"/>
      <bbox-query {{bbox}}/>
  <!-- print results -->
  <print mode="body"/>
  <recurse type="down"/>
  <print mode="skeleton" order="quadtile"/>

3 Answers 3


The query is all right. You are getting only nodes because your query area is big and the overpass server times out while processing nodes, it never gets to process the ways.

Either reduce your area or set larger timeout. And if you need only major highways, you should query for highway=primary or highway = trunk.

  • I don't know how to query for highway = primary/secondary/motorway/trunk. I tried typing that into the wizard and it rejected my query. Can you show me the syntax? I am very new to osm and gis in general
    – bernie2436
    Mar 13, 2014 at 1:30
  • 1
    it should be like 'highway=primary or highway = trunk ....'
    – neogeomat
    Mar 13, 2014 at 4:19

Use http://overpass-turbo.eu/

I had the same problem as you and really put alot hours in it...

At the end this is what i came up with:

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

You can modify witch types of highways you want to see here:

<has-kv k="highway" regv="*"/>

You can get all Types here: http://wiki.openstreetmap.org/wiki/Key:highway


On Overpass Turbo ...

Click the button (6th from left) which reads "Load" In the small window which appears click 'Templates' Click 'key-value' This provides a template for more specific queries of the data. On this template you'll see the lines...


Replace the '???' with pairs of values like: {{key=highway}} {{value=motorway}} Consult the OSM wiki page listing map features You'll see (scroll down the page) that data lines within OSM are tagged with a key/value pair like highway=motorway, or natural=river. A query simply looking for the highway key will return all sorts, from motorways to paths.

Actually you can edit this template down lots. Something like this works...

<osm-script output="json">
    <query type="way">
      <has-kv k="highway" v="motorway"/>
      <bbox-query {{bbox}}/>
  <print mode="body"/>
  <recurse type="down"/>
  <print mode="skeleton"/>

That's because until you know what you're doing you're probably only looking for 'way' data not 'relations' or 'nodes' (certainly for something like a motorway).

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.