Skip to content

Instantly share code, notes, and snippets.

@onderaltintas
Created October 16, 2023 00:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onderaltintas/1c9c0023aece9e53b8fe57aa175d11fd to your computer and use it in GitHub Desktop.
Save onderaltintas/1c9c0023aece9e53b8fe57aa175d11fd to your computer and use it in GitHub Desktop.
turf-sandbox snippet
// simply return a valid GeoJSON and it will be rendered on the map
const p = turf.point(
[0, 90],
{'marker-symbol': 'rocket', 'marker-color': '#F00', 'marker-size': 'large'}
);
const poly = turf.polygon([[
[
15,
88
],
[
-15,
88
],
[
-195,
80
],
[
195,
80
],
[
15,
88
]
]],
{stroke: '#0FF', fill: '#0FF', 'fill-opacity': 0.3, 'stroke-width': 6}
);
var inside = turf.inside(p,poly);
console.log(inside)
return turf.featureCollection([poly, p]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment