简体   繁体   中英

Query Overpass API for highways and corresponding nodes

Can someone perhaps be so kind to give me some hints? I completely fail to put all the simple overpass examples together to get what I need:

  • Inside the relation: http://www.openstreetmap.org/relation/2618040
  • I want to get all ways where "highway" is "motorway, trunk, primary, motorway_link, ..."
  • All nodes those ways are referring to.
  • From the ways I want to keep the tags name , highway and oneway
  • I want the nodes without any additional data. Like so: <node id="122317" lat="53.5282633" lon="10.0232716"/>

I'm not an Overpass API expert but this should work:

[out:json][timeout:25];
area["iso3166-2"="DE-HH"];
way(area)["highway"];
(._;>;);
out;

See the result on overpass turbo (warning: this is a lot of data, your browser could have trouble handling it). You might also have to increase the timeout for the query to succeed. Alternatively see the raw data directly from Overpass API.

I replaced your relation ID 2618040 with a specific tag which should be more stable. But of course you can also use the relation ID if you like. For this you have to add 3600000000 to the relation ID because areas aren't native elements in OSM:

[out:json][timeout:25];
way(area:3602618040)[highway];
(._;>;);
out;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2025 STACKOOM.COM