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

I'm using OSM API (overpy and overpass using Python3) to extract toll roads "toll=yes" in a certain search area (e.g. searchArea = California). The API spits out all the tolled ways in CA split into ways. What I'd like to see is each toll road as a whole, i.e. not split into ways.

Is there a way to regroup all the tiny ways back into the bigger road? How are ways linked in OSM?

asked 25 Dec '17, 20:37

omarfaskar's gravatar image

omarfaskar
11112
accept rate: 0%


The ways are linked via common/shared end nodes. Essentially you need to define which properties/tags should be the same over a "bigger road" (for example the name tag) and create one geometry our of the segments by joining them at the end nodes.

permanent link

answered 26 Dec '17, 15:59

SimonPoole's gravatar image

SimonPoole ♦
44.7k13326701
accept rate: 18%

edited 26 Dec '17, 16:00

  1. First extract all <nd ref=""/> tags
  2. Remove duplicate tags with uniq -u
  3. Reassemble into a way with <way></way>
  4. Done!
permanent link

answered 29 Dec '17, 04:35

Wetitpig0's gravatar image

Wetitpig0
307161928
accept rate: 10%

edited 29 Dec '17, 04:35

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:

×710
×483
×167
×4

question asked: 25 Dec '17, 20:37

question was seen: 2,103 times

last updated: 29 Dec '17, 04:35

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