-
Notifications
You must be signed in to change notification settings - Fork 994
Closed
Description
Summary
According to the docs shortestPath accepts Polygon | Feature<Polygon> | FeatureCollection<Polygon> as obstacles. However an invalid obstacles error is thrown if you provide a Feature<Polygon> as obstacle.
Example
When you run the following code an invalid obstacles error is thrown.
import { shortestPath } from '@turf/turf';
const start = [13.811772324108205, 52.15187842149308];
const end = [13.80780718427863, 52.15711694225445];
const obstacle = {
type: 'Feature',
properties: {},
geometry: {
type: 'Polygon',
coordinates: [
[
[13.809135109049322, 52.1533094692154],
[13.809135109049322, 52.152020775802356],
[13.8130016727888, 52.152020775802356],
[13.8130016727888, 52.1533094692154],
[13.809135109049322, 52.1533094692154],
],
],
},
};
const result = shortestPath(start, end, {
obstacles: obstacle,
});Version
I tested this with @turf/shortest-path version 7.2.0
Note
I'll create a pull request to fix this issue.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels