perliedman / geojson-path-finder

Find shortest path through a network of GeoJSON
https://www.liedman.net/geojson-path-finder/
ISC License
301 stars 87 forks source link

[compactor] strange result when trying to reach a removed (compacted) node #27

Closed bertrandmd closed 3 years ago

bertrandmd commented 6 years ago

Hi !

I've a strange issue, and I need to shortcut the compactor to resolve it.

this is my network, and displayed points are nodes who are removed by compactor: (here) capture d ecran 2018-01-23 a 11 55 18

this is my expected path result: capture d ecran 2018-01-23 a 11 57 32

this is what I get: capture d ecran 2018-01-23 a 11 57 45

I've checked some relations : capture d ecran 2018-01-23 a 12 34 51

Do you think it's an issue ? or it is simply impossible to access these compacted/removed nodes ?

EDIT : access to compacted/removed node seems to be purpose of _createPhantom() method, so we have an issue

thanks for your support and your library !

Bertrand

bertrandmd commented 6 years ago

this issue is only on destination. (if I reverse my route, I have the expected result)

perliedman commented 6 years ago

Hi, interesting. I'm not entirely sure when I will have the time to dig into this, but if it would be possible for you to share the network you're using (possibly just the part you're showing here) and the actual waypoints you use to cause this problem, it would be very helpful.

The best way to track things like this down is usually to add a new test to the library and go from there.

taneltm commented 5 years ago

Ran into the same issue. Happened exactly the same way and reversing the route displayed correct results. I might take a closer look into the issue if it happens again.

For now I solved the issue by using turf.js and splitting my routing network lines into smaller chunks. This basically adds nodes along the line, so next node is definitely on the line and there's no need for the algorithm to take a shortcut. https://turfjs.org/docs/#lineChunk

perliedman commented 5 years ago

A PR with a failing test case would be very welcome! (A PR with a working fix is of course even more welcome...)

reyemtm commented 4 years ago

@taneltm can you elaborate I am getting similar results with these "shortcuts" appearing, and not just at the end of the paths. If I cut it into 2 foot chun

@perliedman all I really need returned is the ids of the original network features that make up the shortest path, I can then build the route from those, and it would seem this would be possible with the edgedata function but I cant get the edgeDatas to return anything

perliedman commented 3 years ago

Fixed by #70, released in 1.5.3.