NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hello Guys

I'm Newcomer Here. Recently I Have A Project Want To Use OSM With Overpass API. My Requirements Are:

  1. Retrieve All Streets (Highway) In A Specified Area. I Know This Is Possible By Kinds Of Ways. For Example Set Query Type As Boundary And Boundary Type = Admin Then Admin Level = N Or By Area With Area ID (Relation ID).

  2. I Need To Get A Lists Of All Highways With Way Type (For Example Motorway / Trunk / Primary / Secondary / Tertiar) And Availability Of Driving And Direction (For Example Is That Way A West-Eastward Way <horizontal> Or North-Southward Way <vertical>. My Question Is That Possible To List All Roads With All Required Values?

  3. I Also Need All Corresponding Nodes (Longitude / Latitude) In A Road (Highway). Does Overpass API Support To Get Nodes Relation Of A Highway? If I Need Only A Few Nodes In A Way Can I Set Parameter (Meter) As Wanted Distance Between Nodes (For Example Every N Meter For A Node)?

asked 12 Oct '20, 05:29

Bright's gravatar image

Bright
26112
accept rate: 0%

It sounds like you have half of it. Have you written any code a a basis?

(12 Oct '20, 16:25) DaveF

Amended VIPINDAS K's answer so it runs. Pivot converts an area into an element. ^ and $ are part of regular expressions, defining the begining & ending of a string. In this example it searches for highways the are either 'trunk' or 'primary'. 'trunk_link' would not be returned,

{{geocodeArea:Malappuram}};
rel(pivot)->.District;
wr[highway~"^(trunk|primary)$"](area);
out geom; 
.District out geom;

{{style: 
way{
color: green;
fill-color: green;
text: name:en;
}
relation{
color: green;
fill-color: green;
text: name:en;
}
}}
permanent link

answered 19 Oct '20, 13:27

DaveF's gravatar image

DaveF
3.3k8498133
accept rate: 16%

Sample code:
[out:json][timeout:25];
// fetch area “Malappuram" to search in
{{geocodeArea:Malappuram}}->.searchArea;
// gather results
(
//query part for: “boundary=Malappuram”;
wr["boundary"="administrative"]["name"="Malappuram"]["admin_level"="5"](area.searchArea);
way["highway"="trunk"](area.searchArea);
way["highway"="primary"](area.searchArea);
relation["highway"="trunk"](area.searchArea);
relation["highway"="primary"](area.searchArea);
//we can add more tags
way{
color: green;
fill-color: green;
text: name:en;
}
relation{
color: green;
fill-color: green;
text: name:en;
}
);
// print results
out body;
>;
out skel qt;

wizard helps to create codes.
Qgis helps to make customized map.

permanent link

answered 19 Oct '20, 08:49

VIPINDAS%20K's gravatar image

VIPINDAS K
1257813
accept rate: 0%

edited 19 Oct '20, 08:59

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×483
×205
×163
×91
×4

question asked: 12 Oct '20, 05:29

question was seen: 2,250 times

last updated: 19 Oct '20, 13:27

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum