Closed Skippern closed 6 years ago
how to do this, or even if it is possible.
OSRM only accepts OSM data in formats that libosmium
supports, which is .osm.pbf
and .osm.xml
. All other data formats need to be exported to this format for usage in OSRM.
so instead of downloading from geofabrik I need to look into a way to export my PostGIS to .osm.pbf
or .osm.xml
format? Probably better in the long run, but if OSRM could read the database directly could avoid double handling of the data. Depends if OSRM need data snapshot or if it can handle live data.
@Skippern The problem with databases is that there are very few well defined schemas that are suitable for easy import into OSRM. If you're just storing geometry objects for roads, you need additional data to define where the geometries connect. Turn restrictions would require additional data structures as well. As far as I know, the OGC (the group that defines WKB, WKT, LineString
, etc) doesn't define any constructs useful for network topology, they focus almost exclusively on geometry.
The OSM database itself is suitable for this - it stores way
, node
, and relation
objects that are connected. There exist tools to trivially export the OSM database schema into a .osm.pbf
file. The OGC field types that PostGIS supports are not so easy to use like this - it's not designed to describe network topology like the OSM database format is.
The community would probably be well served by a tool that can export a PostGIS database into .osm.pbf
form, but it wouldn't be a straightforward project.
You might want to take a look at pgRouting, and the steps you need to go through to convert a geometry-based database into something that's routable. The "create topology" step that pgRouting has would be equivalent to whatever you had to write to export your geometry into OSM format - there's no getting around that problem.
As far as OSRM is concerned: it's kind of outside what we envision the scope of the project to be. OSRM routes on OSM-structured data. A good quality OGC-SQL to OSM converter would probably be welcomed by the community for use with more than just OSRM.
Just want to flag that PostGIS does have some topology, but I haven't seen it in use. Certainly, it's not the format that osm2pgsql
creates when loading data from OSM - that import is somewhat lossy.
I'm going to close this as not actionable. I think we'd be happy to post links to a good quality sql2osm
converter as a standalone project however.
Instead of downloading data from geofabrik every now and then, I would like OSRM to load data from a local PostGIS database (I have set it up for mapnik/mod_tiles, and other services). I cannot find any information about how to do this, or even if it is possible.