GraphHopper.com | Forum | GitHub | Maps | Blog

Сreate a graph from my data


#1

Good afternoon!

I have a task to build a graph from my shp files. I found the reader-sp in git, but I can not figure out how to use it to prepare the data for the graph-hopper machine.
Give me the way.


#2

Good afternoon,

this is a good question, I think the shape reader is under documented. I will see if I can improve this.

Anyway regarding your question, have a look at the class GraphHopperSHP. You should be able to use this class instead of GraphHopperOSM and the ShapeFileReaderTest.

Let me know if this helps?

Best,
Robin


#3

Hello @boldtrn,
I’ve checked docs and also have no clue how do I take shp files and make graphhopper use it as routing data source.
Any hint?


#4

As I said, there is not much documentation on the ShapeFileReader.

Yes, the simplest and fastest way to do this is to replace code occurrences of GraphHopperOSM with GraphHoppperSHP (I don’t recommend this for production though). You might need to change some parameters etc. I haven’t done this before. Have a look at the ShapeFileReaderTest to see how to correctly instantiate the GraphHopperSHP class.

Also have a look at this issue, that I created after you asked this question. A PR improving this would be very welcome :).

Cheers,
Robin