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, 05:29

Bright's gravatar image

Bright
262
accept rate: 0%

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

(12 Oct, 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, 13:27

DaveF's gravatar image

DaveF
1.7k606892
accept rate: 5%

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, 08:49

VIPINDAS%20K's gravatar image

VIPINDAS K
11019
accept rate: 0%

edited 19 Oct, 08:59

Your answer
toggle preview

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:

×393
×171
×150
×85
×3

question asked: 12 Oct, 05:29

question was seen: 127 times

last updated: 19 Oct, 13:27

powered by OSQA