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

How to find road is urban or interurban?

asked 22 Jun '15, 09:48

Gauravk's gravatar image

accept rate: 0%

This is a very difficult question to answer. Whether something is an urban road, or not, is quite subjective. OSM doesn't have good coverage of the physical descriptive things that would allow you decide whether a road is urban (e.g. lanes, road width, footpath, parking status). Maybe you could look at surrounding features (like how many km of residential roads there are? How many buildings are nearby? Speed limit of the road?)

Can I ask what you're trying to do? Perhaps there's a better solution?

permanent link

answered 22 Jun '15, 10:13

rorym's gravatar image

accept rate: 11%

Thanks for your suggestion. My end goal is to find the max speed.I have longitude and latitude value only. I put longitude and latitude value to url as a parameter:<latitude>&lon=<longitude> Output: { "place_id": "72249684", "licence": "Data © OpenStreetMap contributors, ODbL 1.0.", "osm_type": "way", "osm_id": "78164485", "lat": "40.713746", "lon": "14.7016650663124", ......

For here I pass osm_id to another url to find speed limit: output

<tag k="highway" v="motorway"/> <tag k="int_ref" v="E 45"/> <tag k="lanes" v="2"/> <tag k="lit" v="no"/> <tag k="maxspeed" v="90"/> <tag k="name" v="Autostrada A3 Napoli-Reggio Calabria"/> <tag k="oneway" v="yes"/> <tag k="ref" v="A3"/> <tag k="surface" v="asphalt"/> </way> </osm>

From this output we can extract the maximum speed for that particular longitude and latitude in two ways First search for the ‘k="maxspeed"’ tag in the XML output, and extract the ‘v’ value for the tag. That represents the max speed in km/hrs. format.

If above tag not present search for ‘k="highway"’ tag, and get the ‘v’ attributes value; Next we need to have a lookup table from where we can get the default value for highway types. Please find the below link for lookup table for different country:

(22 Jun '15, 10:35) Gauravk

Gauravk, is there a kind of government (city, regional, provincial and country wide), who have a highway plan released with categories like the one you’re searching ? Those plans should or could contain urban or interurban ways and eventually other categories of ways.

(22 Jun '15, 21:45) Hendrikklaas

Thanks for you comment. Its is kind of GPS. Still no luck I hope someone will help me out here.

(24 Jun '15, 07:29) Gauravk

There is no easy solution to your problem. The only thing you can do is creating a heuristic based on the information mentioned in rorym's answer. Currently most routers don't even create complex heuristics but instead just look at the highway class and surface value if no maxspeed tag is present.

(24 Jun '15, 08:21) scai ♦

Thanks scai,How can I use Tag:surface for urban area?

(24 Jun '15, 09:54) Gauravk

That's not what I meant. But you can use it additionally to the highway class to guess the maxspeed if it is not present.

(24 Jun '15, 10:10) scai ♦
showing 5 of 6 show 1 more comments

Although I am not sure about your practical reasons, here is one possible geometry based option. The answer is an interpretation/application of a higher grade student task in algorithms to your case (naturally, many fine details are left out). 1. Assume, from an OSM Planet-dump (or from other OSM based sources) and for an area of interest you have extracted all area objects that you consider as "urban" (e.g. landuse=residential, and landuse=industrial ... add filters as you wish). For practical/efficiency reasons you could merge and convert this set of areas into a set "U" of disjunctive closed simple areas (no common border sections, borders belong to the areas and one outer with arbitrary inner borders in relations).
2. Assume, you have a road "R" from road-class of interest (e.g. from primary roads) as a polygonal line (careful about the roundabouts, long edge-vectors...). Also, assume you have a distance criteria "D" (e.g. 50m) what you consider as a critical distance whether a point or a vector might be considered as "urban" or not.
Now, for any of the edge vectors of R find the closest element from U at distance d (minimum distance d, between a point of the vector and a point of the area). If this distance d is less than D mark the vector as "u" (urban). At the end, all consecutive vectors/edges marked with "u" form/create your urban road sections and the contrary.

permanent link

answered 25 Jun '15, 09:23

sanser's gravatar image

accept rate: 5%

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 22 Jun '15, 09:48

question was seen: 5,509 times

last updated: 25 Jun '15, 09:23

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