Skip to content

Instantly share code, notes, and snippets.

@lpirola
Created September 16, 2018 15:25
Show Gist options
  • Save lpirola/a6decc492848221c2622a913fc5fb375 to your computer and use it in GitHub Desktop.
Save lpirola/a6decc492848221c2622a913fc5fb375 to your computer and use it in GitHub Desktop.
// construção do polygon a partir de um ponto
var center = [-75.343, 39.984];
var radius = 5;
var options = {steps: 10, units: 'kilometers', properties: {foo: 'bar'}};
var circle = turf.circle(center, radius, options);
// checagem se um ponto está no polígono
var pt = turf.point([-77, 44]);
var poly = turf.polygon([[
[-81, 41],
[-81, 47],
[-72, 47],
[-72, 41],
[-81, 41]
]]);
turf.booleanPointInPolygon(pt, poly);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment