简体   繁体   中英

Query Overpass API for roads in a specific country

I'm trying to construct a query of all 'highway=' ways in a specific area in overpass. I've been defaulting to using the {{bbox}} - but I really would prefer to do it by country.

I've tried using 'nominatimArea:' instead of {{bbox}} but I get a parse error ' line 8: parse error: ')' expected - '(' found. ' on the below:

/*
This shows the roads in nepal.
*/

[out:json];

(
  way ["highway"~"motorway|trunk|primary|motorway_link|trunk_link|primary_link|unclassified|tertiary|secondary|track|path"]({{nominatimArea:Nepal}});
);

out meta;
>;
out skel qt;

ALSO ... if I try this...I only (weirdly) get one area - no ways (maybe the relations are a mess?)

/*
This shows the roads in nepal.
*/

[out:json];

(area[name="Nepal"];
  way(area) ["highway"~"motorway|trunk|primary|motorway_link|trunk_link|primary_link|unclassified|tertiary|secondary|track|path|residential|service"];
);

out meta;
>;
out skel qt;

Returns this one item (and it is an area NOT a way)

Note: I know this is a large query - but I really just need the url to the raw JSON (like this ) - not the actual overpass map result.

Got it.

/*
This shows the roads in nepal.
*/

[out:json];

area[name="नेपाल"];
 (way["highway"~"motorway|trunk|primary|motorway_link|trunk_link|primary_link|unclassified|tertiary|secondary|track|path|residential|service|secondary_link|tertiary_link"](area);
);

out meta;
>;
out skel qt;

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