ShortestPath & geoJSON
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 10.5k
- Forks
- 1k
- Avg merge
- 1h 11m
- Merged PRs (30d)
- 4
Description
Do you have any tips on how to use this with a land geojson? I'm trying to plot a course between two points and avoid land masses, which is represented by a GeometryCollection of Polygons.
But, it throws me an invalid obstacles error probably because the geometry is a multipolygon. So, I try to flatten it using turf.flatten but now I'm stuck in a massive loop.

You can find the geojson file at:
http://www.luanngo.ca/apps/game/res/land_sm.json
Thanks!
var start = [-11.777343749999979,40.44694705960049];
var end = [62.22656250000001,19.97334878611059];
$.get("http://www.luanngo.ca/apps/game/res/land_sm.json").done(function(data){
data=turf.flatten(data);
var options = {
obstacles: data
};
var path = turf.shortestPath(start, end, options);
});
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the turf.shortestPath entry point and the turf.flatten usage shown in the issue, then inspect how the obstacles option validates GeometryCollection and multipolygon data. Confirm whether the supplied land_sm.json reproduces the invalid-obstacles error or the loop, and document the supported input shape and a working usage pattern.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- data
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100