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

For a project I'm using OSRM to map match a series of GPS measurements to a custom road network. My goal is to provide insight in where but more importantly how many times the vehicle has visited each road segment in the road network. My desired output is (1) an attribute table of the road network with an extra column that shows the number of times the vehicle drove through the street, (2) a map visualisation of the flow of traffic through the network, with the width of each line segment representing the amount of traffic (i.e. based on the visit frequency values in the attribute table). Something like this:

alt text

I have been able to convert a custom road network in shapefile format to .osm data using ogr2osm and succesfully map match the GPS points to this network. Using the option "annotations=nodes" in the OSRM request I'm able to get all the node id pairs and geometry from the API response. This would allow me to tabulate and rank the most common segments, and display them visually, no joining to a PBF required. However, the original node id's from the shapefile appear to have lost after the conversion. Instead, new node id's have been chronologically numbered in the .osm file (see below). This makes it impossible to come to the desired output as described above. Does anyone have a solution to retain the original node id's from the original shapefile road network? Or does somebody havee a better solution for what I'm trying to achieve?

alt text

asked 12 Feb '21, 15:32

winecity's gravatar image

winecity
26335
accept rate: 0%

edited 12 Feb '21, 15:36

Slightly confused by this - what do you mean by "original node ids from the shapefile"? Shapefile linestring geometries don't have node ids.

(12 Feb '21, 19:35) Richard ♦

The attribute table of my shapefile has a column "source" and a column "target" to indicate the node id's. I was hoping these node id's would be recognized in the .osm file after the conversion, but apparently this is not the case. Do you know if there's another way?

(15 Feb '21, 13:15) winecity

Shapefiles aren't topological (i.e. they don't represent junctions between roads). Linestrings in shapefiles do not have individual attributes for each point, only for the linestring as a whole. For what you're trying to do, a shapefile seems a really bad fit. It would be better if you could get your software to output .osm directly.

(16 Feb '21, 15:51) Richard ♦

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
×535
×85
×11
×6

question asked: 12 Feb '21, 15:32

question was seen: 3,002 times

last updated: 16 Feb '21, 15:51

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