geojson-path-finder icon indicating copy to clipboard operation
geojson-path-finder copied to clipboard

Error: Compacted graph contains no forks (topology has no intersections) if GeoJSON is a closed loop

Open oleg131 opened this issue 2 years ago • 1 comments

If input GeoJSON is a closed loop, I get the following error on initialization:

const pathFinder = new PathFinder(geojson);
Uncaught Error: Compacted graph contains no forks (topology has no intersections).
    at new PathFinder (index.js:formatted:1)
    at calculate (RoutingPage.js:375)
    at HTMLUnknownElement.callCallback (react-dom.development.js:3945)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:3994)
    at invokeGuardedCallback (react-dom.development.js:4056)
    at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:4070)
    at executeDispatch (react-dom.development.js:8243)
    at processDispatchQueueItemsInOrder (react-dom.development.js:8275)
    at processDispatchQueue (react-dom.development.js:8288)
    at dispatchEventsForPlugins (react-dom.development.js:8299)
    at react-dom.development.js:8508
    at batchedEventUpdates$1 (react-dom.development.js:22396)
    at batchedEventUpdates (react-dom.development.js:3745)
    at dispatchEventForPluginEventSystem (react-dom.development.js:8507)
    at attemptToDispatchEvent (react-dom.development.js:6005)
    at dispatchEvent (react-dom.development.js:5924)
    at unstable_runWithPriority (scheduler.development.js:468)
    at runWithPriority$1 (react-dom.development.js:11276)
    at discreteUpdates$1 (react-dom.development.js:22413)
    at discreteUpdates (react-dom.development.js:3756)
    at dispatchDiscreteEvent (react-dom.development.js:5889)

Removing a single LinePath from GeoJSON makes the error go away.

GeoJSON used: https://pastebin.com/2mfrUxYU

oleg131 avatar Aug 18 '21 22:08 oleg131

Workaround: add some nearby point to the end of an arbitrary segment, so it looks like an appendix. It will not influence path calculation but makes the error go away.

oleg131 avatar Aug 18 '21 22:08 oleg131