Reputation: 677
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.
Upvotes: 5
Views: 2900
Reputation: 1032
A modification to user14696's answer as usually difficult to use local names. It would be more convenient to use your own language or English which most countries already had it set.
[out:json];
area["name:en"="Nepal"][admin_level=2];
//area["name:en"="Gandaki Province"][admin_level=4];
//area["name"="Waling"][admin_level=7];
(
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;
Some places have missing tags and some may have specific way of naming like dual language and triple language. So specific language name:xxx
may more helpful then local name
tag.
In many places, same town name is used multiple administrative levels, so it is good to filter by admin_level
too.
Some queries are very heavy, may be fast to try on small area at the start.
Keep OpenStreetMap page open, and look for tag which may help or may be contribute missing tags. For example: Waling has only name
tag and it is in English. while many other tags with Nepal (anyway, it is a country level)
Upvotes: 0
Reputation: 677
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;
Upvotes: 9