2
2

Hi everyone,

When I export the .osm data, I'd like it to give me only roads that cars can actually drive on if possible? At the moment it's giving me buildings, walking paths in the middle of parks and all sorts.

Is there a quick fix for this? Not all nodes have tags which state whether they are highways so actually going through them one by one would be painful...

Thanks!

asked 12 Feb '14, 22:58

Kyanite's gravatar image

Kyanite
36234
accept rate: 0%

Update: I have discovered OSMFilter, however am unsure how to filter just roads and remove everything else!

--keep="highway=" I'm assuming I will need this, however how can I drop all other non-vehicle roads?

(12 Feb '14, 23:24) Kyanite
1

Please ask a new question about osmfilter (if you cannot find it in the previous questions). however, I think it should be clear on the wiki page: you need to filter for tags (not only keys). Note: I did not use this tool on my own.

(12 Feb '14, 23:31) aseerel4c26 ♦
1

One thing to think about - what do you consider a road that cars can drive on? A "highway=footway" obviously isn't, and a "highway=primary" obviously is, but what about "highway=track"? Also you may want to think about "access" tags.

(12 Feb '14, 23:33) SomeoneElse ♦

4 Answers:
2

To know which highway tags are important for cars, have a look at these wiki pages:
http://wiki.openstreetmap.org/wiki/Highway
http://wiki.openstreetmap.org/wiki/Key:access

As a start point, you should select ways (and only ways, not nodes) with:
- highway=motorway or highway=motorway_link
- highway=trunk or highway=trunk_link
- highway=primary or highway=primary_link
- highway=secondary or highway=secondary_link
- highway=tertiary or highway=tertiary_link
- highway=unclassified or highway=unclassified_link
- highway=residential or highway=residential_link
- highway=service or highway=service_link
- highway=living_street
- highway=track (possibly combined with a graduation tag)
- highway=path (only if combined with "motor_vehicle=yes" or "motorcar=yes")
- highway=road (might be ignored since the highway class is unknown and might be impassable for cars)

The tag "access" is important (the legal status). Absence of access tags means "allowed". Otherwise, look if "motor_vehicle=yes|no" or "motorcar=yes|no" is present. Otherwise, look for a general access definition like "access=yes|permissive" for "allowed" or "access=private|delivery|emergency|forestry|no" for "disallowed".

If you care about direction, check the tag oneway=yes|-1|no or junction=roundabout

permanent link

answered 13 Feb '14, 13:07

Pieren's gravatar image

Pieren
9.7k2075157
accept rate: 15%

2

I'd add one caveat to that, where it says 'Absence of access tags means "allowed"':

The meaning of the absense of an access tag is very dependant on context. If it's in an area in which it's clear that all of the access rights have clearly been surveyed by people on the ground, then it might well mean that.

However, if it's a rural area where data has come from aerial imagery, it actually means "not yet known". For example in England I wouldn't assume that I had legal motor vehicle access to a highway=track unless it had an approriate access tag.

(13 Feb '14, 13:47) SomeoneElse ♦
1

There are also implicit default access values which should be used whenever there are no access tags present.

But as already explained by SomeoneElse a missing access tag doesn't always mean that the default access restrictions apply. It could also indicate that nobody has checked the legal access status yet.

(13 Feb '14, 14:06) scai ♦

Even with surveyed roads, nobody is adding an explicite "access=yes" tag to all created highways. Probably because the access tag reflects a road sign most of the time. And in absence of road signs, "what is not forbidden is allowed".

(13 Feb '14, 14:26) Pieren
1

"what is not forbidden is allowed". In some countries perhaps; most certainly not in others. :)

The point about implicit access rules saying things like "you are allowed to drive on a highway=primary" is well made; no-one is suggesting tagging them all with "motorcar=yes".

However, the point that I was trying to make was that anyone extracting highway data from OSM has to think about how it got there, and how much information is missing (because it's just never been surveyed) from what they've extracted.

(13 Feb '14, 14:34) SomeoneElse ♦
1

This is true but not only for access tags, for all attributs in OSM in general.

(13 Feb '14, 15:48) Pieren

@Pieren Could you direct me to the syntax...i understand the logic but am struggling with proper syntax

(25 Oct '17, 13:27) amishra
showing 5 of 6 show 1 more comments
5

An easy way to get predefined data is the Overpass API with its user friendly tool Overpass Turbo.
I created a query for all highways except footway, path and pedestrian which you can find (and enhance) here: http://overpass-turbo.eu/s/2vM

hth
malenki

permanent link

answered 13 Feb '14, 17:10

malenki's gravatar image

malenki
4.7k24683
accept rate: 6%

1

You forgot to exclude highway=steps :) And depending on the use-case one could exclude highway=construction, too. And nodes which have a highway tag but aren't part of a way with a highway tag, such as highway=bus_stop.

(13 Feb '14, 18:41) scai ♦

yes - thanks for the addition

(13 Feb '14, 18:45) malenki
3

You don't say what program you're feeding the OSM data into. Usually, any such filtering would be done by this "client" program. For example, if you were using a renderer such as Mapnik, you would write a stylesheet that only uses the highway= tags.

permanent link

answered 13 Feb '14, 00:58

Richard's gravatar image

Richard ♦
28.5k40253383
accept rate: 19%

2

I guess using osmfilter (read the section about Object Filter) afterwards is a good option as I do not know of the osm.org export being able to filter server-side. However, thirdparty services may help too (e.g. overpass turbo could be an option). It depends on your usecase what is best.

permanent link

answered 12 Feb '14, 23:28

aseerel4c26's gravatar image

aseerel4c26 ♦
32.2k16239552
accept rate: 18%

edited 12 Feb '14, 23:29

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:

×287
×195
×77



question asked: 12 Feb '14, 22:58

question was seen: 34,379 times

last updated: 25 Oct '17, 13:27

powered by OSQA