| Forum | GitHub | Maps | Blog

Import an existing graph


Hi everyone,
I’ve read that GrapHopper uses OpenStreetMap and GTFS data but can import other data sources. I was wondering if is it possible to import an existing graph? whether is possible, how should I do that?
Thank you


Generally speaking GraphHopper has different Reader implementations for different data sources, currently OSM and GTFS. If you want to load a different source the best approach would be to implement your own reader for your data type.

Importing a GraphHopper graph should be very easy and straight forward. On the first start GraphHopper will build a graph directory from your source file. With every consecutive start GraphHopper will use the previously imported graph instead of creating a new one.

Hope this helps?



Thank you, I will try that.


the graph that I want to import was done in OTP, should it work too? it is for public transit routing in UK, but OTP requieres a lot of memory and it is so slow.
Your help would be very appreciated.



I don’t know the details of OTP to be honest. GraphHopper can model a public transport network, including time schedule of trains/buses/ferries/…, so my general assumption would be that it should be possible. Orientate yourself at the GTFSReader and try if it will work :).

I would assume that having an OTPReader in GraphHopper would be a nice addition, so I think we would be very happy to see a PR for this as well :).



I do not know if and why we should read from some binary file. Using some configuration and the source files is the best approach IMO