mapbox / osrm-isochrone

Generate drivetime isochrones from OpenStreetMap data using OSRM
MIT License
126 stars 50 forks source link

Example "./dc.osrm" issue #18

Open sosso opened 7 years ago

sosso commented 7 years ago

Hi,

I have a file up and running according to the OSRM instructions at https://github.com/Project-OSRM/osrm-backend/wiki/Running-OSRM (the '4 steps' section at the top)

This gives me a bunch of california-latest.* files, including a .osrm file. I run osrm-routed, and it gets to "running and waiting for requests" in another prompt.

I then use the example js file you provide in the network tab (in my case, ./california-latest.osrm) and run the file. I'm given an error about invalid fingePrint (sic).

I also ran into discrepancies between the Build section of the README and the steps provided by OSRM; there is no osrm folder inside osrm-isochrone in my node_modules. There is an osrm folder in node_modules, and it does have the lib/binding/osrm-extract executable, but not the osrm-prepare file.

Additionally, where should we get a .osm file? Is that the same as a pbf?

Thanks for the work to get this closer; eagerly awaiting being able to use this!

divingdeer commented 7 years ago

I do not know about the 'invalid fingePrint' error, but I will try to help you with the other questions.

I think you have installed the osrm package separately. In that case npm does not install the package again. This should not matter. You can delete the osrm folder, and then install osrm-isochrone again. You are right about the osrm-prepare executable, that one is replaced by osrm-contract. I will create a pull request.

The .osm.pbf files are compressed, just like the .osm.bz2 files. But the tools osrm-extract and osrm-contract can read the .osm.pbf files.

mvl22 commented 7 years ago

I run into a Fingerprint mismatch error too - sounds like the same problem. I'm running OSRM v5.4.0 as a separate instance, and specifying network to point to my .osrm file.

Using the example at: https://github.com/mapbox/osrm-isochrone#advanced

substituting the path to my .osrm file, I get:

$ node isochrone.js 
/usr/share/npm/node_modules/osrm-isochrone/index.js:24
        var osrm = options.network instanceof OSRM ? options.network : new OSRM(options.network);
                                                                       ^

TypeError: Fingerprint mismatch in /path-to-my-directory-containing-merged.osrm/merged.osrm.icd (at include/storage/io.hpp:59)
    at TypeError (native)
    at getIsochrone (/usr/share/npm/node_modules/osrm-isochrone/index.js:24:72)
    at Object.<anonymous> (/usr/share/npm/node_modules/isochrone.js:25:11)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Function.Module.runMain (module.js:442:10)
    at startup (node.js:136:18)
    at node.js:966:3
daniel-j-h commented 7 years ago

/path-to-my-directory-containing-merged.osrm/merged.osrm.icd

You can't merge .osrm files. Anything similar to cat 1.osrm 2.osrm > merged.osrm will fail horribly. What you can do is merge several .osm.pbf files and generate a single .osrm file with osrm from that.

A fingerprint errors means the data was prepared (osrm-extract, osrm-contract) with a different version and is likely not compatible. In general: osrm-extract, osrm-contract and your libosrm / osrm module have to be in sync.

If you npm install osrm you will find the in-sync osrm binaries at

node_modules/osrm/lib/binding/

Same for profiles.

mvl22 commented 7 years ago

You can't merge .osrm files.

Yes, aware of that - would be a completely invalid binary as you suggest! To clarify, I'm dealing with a single .osrm file (that happens to be based on data previously merged upstream, and therefore happens to be called merged.osrm) - I should have just changed the filename in my posting above to avoid any confusion. The .osrm file works fine in the routing engine.

mvl22 commented 7 years ago

A fingerprint errors means the data was prepared (osrm-extract, osrm-contract) with a different version and is likely not compatible. In general: osrm-extract, osrm-contract and your libosrm / osrm module have to be in sync.

Does this mean in practice that the network parameter is usually unlikely to be useful, unless both the osrm-isochrone module and the separate OSRM installation happen to be at the same version?

daniel-j-h commented 7 years ago

This package depends on the osrm package (check https://www.npmjs.com/package/osrm).

You will get osrm-extract, osrm-contract binaries which you can use via the osrm package, inside the node_modules directory. And yes, the road network file you specify has to be prepared with the same version.

Check

find node_modules/osrm/ -name 'car.lua'

for the default car profile and

find node_modules/ -name 'osrm-extract'
find node_modules/ -name 'osrm-contract'

for osrm binaries to pre-process your base map with. Hope that helps.

Maybe we should make this a bit more clear in the Readme. cc @TheMarex

mvl22 commented 7 years ago

Maybe we should make this a bit more clear in the Readme.

Thanks - that would be useful.

I see it's currently at 5.4.1 so looks like I'm not actually that far off :)