[GraphHopper] Strange results for GraphHopper paths

Nicolas Gillet nicolas.gillet at market-ip.com
Tue Jul 16 07:09:01 UTC 2013


Hello,

I had the exact same problem converting shapefiles into graphhopper's graph, hopefully it has nothing to do with my path post-process.
(Btw, you can disable path finishing by calling GraphHopper.setFinishPath(false); )
The problem is that geometries in graphhopper (or in osm ?) are reverted compared to the conventional direction of a shapefile's LineString.
So when the path is built, the nodes are added in the right order but the in-between edges' geometries are added reverted, that's why you see this flipping path.

To solve this, I had to revert the PointList before setting them to edge
As I wrote my own specific reader for our shapefile datasource (with GeoTools library) it was very easy to solve. 
I've never use JOSM, I don't know if it can easily be tricked to do the same.

Nicolas GILLET


Market-IP - Creating Mobile Intelligence
Phone : +32 81 33 11 11 
Fax : +32 81 33 11 10
www.market-ip.com - www.telefleet.com - www.geoplanning.net - www.drivexpert.net 


-----Message d'origine-----
De : Peter K [mailto:peathal at yahoo.de] 
Envoyé : mardi 16 juillet 2013 07:53
À : graphhopper at openstreetmap.org
Objet : Re: [GraphHopper] Strange results for GraphHopper paths

Hi Joel,

if there is a bug (which would be very important to fix), such "flip-flop" paths could occur when the extraction of a path (Path4CH) does not work properly.

> So far so good, but as of yesterday, making any change to the OSM file in JOSM is creating very strange paths.

It would be very good if I could somehow debug the code to see what is going on. So I need either a failing test case with the master branch of graphhopper or your modified fork and the data otherwise I can only pray ;)

> The reason I'm using the ngmip fork is to be able to route between 
> these arbitrary coordinates

If you have this complete different use case you might be more happy if you just create the graph within a new "rail reader" as you don't need OSM attributes, no pillar/tower node optimizations, cars/bikes etc. Have a look into the simplistic PrinctonReader where you just create edges via g.edge and additionally you can set the coordinates via g.setNode(internalNodeId, lat, lon), you can also create a simple rail-FlagEncoder based on the existing car encoder for example.

Regards,
Peter.

> Hi,
> I've been using the ngmip fork of graphhopper for a bit of an 
> unconventional use - to route railway segments (many would call this 
> "one big hack").
>
> I've got a shapefile of all the railway lines, that's been converted 
> into an OSM file with JOSM, marking ways as 'highways="primary"'. I 
> then route between each unique pair of train stations in the 
> Netherlands by coordinates, to be able to create national map based on 
> precomputed segments, to be able to use for disruptions and individual 
> trains. The reason I'm using the ngmip fork is to be able to route 
> between these arbitrary coordinates - stations are often halfway 
> ways/noes.
>
> So far so good, but as of yesterday, making any change to the OSM file 
> in JOSM is creating very strange paths. Even the smallest change in 
> totally unrelated ways is triggering "flipflopping" - see this
> screenshot: http://i.imgur.com/hqpozAi.png I tried doing a diff 
> between the two OSM files, but it seems more than just deleting a few 
> nodes is happening.
>
> Does anyone have a sense of what might be happening? Is this a JOSM 
> bug, or is it related to how GraphHopper handles OSM? Or is this an 
> issue specific to the ngmip fork?
>
> If need be, I can upload the correct and misbehaving OSM files.
>
> Thanks in advance,
>
> Joel Haasnoot
>
> _______________________________________________
> GraphHopper mailing list
> GraphHopper at openstreetmap.org
> http://lists.openstreetmap.org/listinfo/graphhopper
>


_______________________________________________
GraphHopper mailing list
GraphHopper at openstreetmap.org
http://lists.openstreetmap.org/listinfo/graphhopper



More information about the GraphHopper mailing list