Project-OSRM / osrm-backend

Open Source Routing Machine - C++ backend
http://map.project-osrm.org
BSD 2-Clause "Simplified" License
6.3k stars 3.33k forks source link

Lack of documentation for the routing with custom dataset #5494

Closed toton6868 closed 5 years ago

toton6868 commented 5 years ago

I am finding for proper documentation where I can get step by step instruction of building OSRM routing with a custom dataset. Is there any link which I missed?

danpaz commented 5 years ago

There are more detailed instructions in the wiki: https://github.com/Project-OSRM/osrm-backend/wiki/Running-OSRM

toton6868 commented 5 years ago

I mentioned custom dataset that means prepare routing from Custom Road network, not the OSM data. This could be newly digitized shapefile or any other GIS format rather than OSM/PBF. In the link you provided its only deal with osm.pbf data.

danpat commented 5 years ago

OSRM only supports loading OSM data - if you have a shapefile or other GIS file, you must first convert it to OSM form.

toton6868 commented 5 years ago

@danpat , I am failing to do so. I have created a newly digitized custom road network similar to OSM shapefile format with a little bit changes. It has the following columns

Screenshot 2019-07-17 at 10 56 17 AM

And the fclass is classified as OSM as well like the following

Screenshot 2019-07-17 at 10 59 59 AM

The structures are almost similar but I tried to mention the lack of documentation on how to use this shapefile or convert the shapefile to use those class with OSRM. I can take care of LUA profile. If you help me to convert and create a custom routing system then I can create a document on the wiki about the step by step guide how to use custom network datasets with OSRM. As there is a huge user in the GIS world is dealing with shapefile I think this will be very helpful.

danpat commented 5 years ago

@toton6868 OSM data is not columnar.

You can read about the OSM formats here: https://wiki.openstreetmap.org/wiki/OSM_file_formats

OSRM is tightly coupled to OSM's data format - a large part of the osrm-extract program is dealing specifically with OSM format details. I doubt anyone has the time or energy to adapt it to work with other file formats.

You might try something like https://github.com/pnorman/ogr2osm - that should take care of the technical file format conversion. However, you will need to ensure that the Lua script you use matches the tags you apply to edges. If you've come up with your own tagging scheme, you'll need to spend some time modifying the car.lua profile to match your tags. It's usually easier to try to transform your data into the tags that OSRM expects (based on the OSM docs at https://wiki.openstreetmap.org/wiki/Map_Features).

toton6868 commented 5 years ago

@danpat According to your suggestion I was successful to convert my shapefile to OSM format data through ogr2osm. For checking the data I have again extracted the osm data to postgis with osm2pgsql and both shapefile and OSM data seems well and overlapping each other nicely. Now I have started the osrm-extract, osrm-contract and osrm-routed process. I got no errors. Finally I tested the routing result through my map service. There I found a lot of nodes missing and the routing is not overlapping the roads.

Here is the scenario

Screenshot 2019-07-17 at 7 50 09 PM

Even you can see the orange line, the alternative route and the blue line, the shortest route, is not overlapping on the same road. I am using car.lua as profile. The part on the image we didn't change anything compared to osm. We actually added few roads in remote areas. I am worried if I am missing any important part of OSRM.

And very very much thanks for your earlier suggestions.

danpat commented 5 years ago

not overlapping the roads

@toton6868 If you're using road geometry from one source, and using a background map from another (in the above, it looks like OpenStreetmap), then it's pretty normal for the geometry to not align. If you want perfect alignment of the route geometry and the background map, you'll need to ensure that ... the geometry of the two maps is the same. Either use OSM as your routing data, or render background map tiles from your road network data.

toton6868 commented 5 years ago

At that point the osm data and my custom data geometry are same. Ialso checked with my geometr. Its lack of nodes. Is projection related to OSRM? I am using a custom projection system. I am currently changing the projection system and doing the things again. I will let you know. Thanks

danpat commented 5 years ago

@toton6868 Which part of the OSRM API response are you rendering on the screen?

If you're using the overview, make sure you add &overview=full&geometries=polyline6 or &overview=full&geometries=geojson to your HTTP query - by default, the OSRM route overview geometry is simplified (coordinates dropped) to reduce network bandwidth for long routes.

toton6868 commented 5 years ago

@danpat &overview=full that's the tricky part. Thanks a lot. Closing. Do I add any documentation in the wiki or that will arise more complicacy to users?

geocept commented 3 years ago

@danpat &overview=full that's the tricky part. Thanks a lot. Closing. Do I add any documentation in the wiki or that will arise more complicacy to users?

@toton6868: could you please provide some documentation about routing with custom dataset. It looks like you found a great solution and sitting on the some problem at the moment: I want to use own dataset that had been created by gps tracker.