I'm working on a project involving historical data, which I'm wanting to turn into an .osm XML file as a routable network (e.g. using OSRM) and for rendering (using Mapnik/CartoCSS). The data will not be added into OSM.

My aim is to convert the Shapefiles into .osm format, and be routable, so that I then get the benefits of the OSM toolsets.

I'm very familiar with OSM and its ecosystem, being a long-time contributor and user. What I'm not so familiar is the GIS world, where a Shapefile (in my case from ArcGIS) has to contain ways and nodes as separate layers.

The main problem I'm having is making the network actually topographically routable.

Can anyone suggest a workflow which would enable the two layers containing lines and junction points to be merged into a single .osm file where the points become nodes actually as properties of the ways?

Currently I am:

  • Taking the Shapefiles from ArcGIS; there are two shapefiles, one with the lines (for the ways) and one for connected junctions
  • Using ogr2osm.py to convert from *.shp to .osm (in WGS84)
  • Then using Osmosis to transform the tags to OSM standards (e.g. waterway=river)
  • Then using Osmosis to merge the layers, using osmosis --rx Edges.osm --sort --rx Junctions.osm --sort --merge --wx merged.osm
  • Building with OSRM as a proof of routability
  • Rendering in Mapnik as a proof of data presence. This does confirm that the network is all present and in the right projection.

The routability partly works - stretches of route do route, but where there are junctions, the routability stops.

My clear hunch is that the .osm data contains all the ways and nodes but that the ways themselves do not reference the nodes.

Is there some adjustment or different toolchain I could use the merge the two layers properly rather than treat them as two sets of items in the one .osm file? I'm trying to avoid having to pick through and modify XML directly, which will not fun.

Any pointers would be appreciated.

asked 09 May '16, 12:42

fooquency's gravatar image

accept rate: 0%

edited 09 May '16, 13:48

Can you elaborate on the role of the "points" shape file. Since the "lines" file will already contain geometries for each road, and could be turned into a routable file by unrolling these geometries into OSM ways and nodes, what purpose does the "points" file have?

(09 May '16, 16:14) Frederik Ramm ♦

The points file was created to have the actual junctions in, as distinct from places where the lines simply cross over (e.g. a bridge). However, I will check on whether this is actually needed. I think we previously tried just the lines file and that didn't give us a properly-routable network.

(09 May '16, 16:27) fooquency

Seems this has worked. Thanks again, Frederik. Turns out the main issue was that I'd chosen highway=motorway in the Osmosis tag conversion, resulting in lots of implied one ways in the router.

(10 May '16, 19:33) fooquency
Be the first one to answer this question!
toggle preview

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](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:


question asked: 09 May '16, 12:42

question was seen: 2,260 times

last updated: 10 May '16, 19:35

powered by OSQA