Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function isInside(testPolygon, targetPolygon) {
var points = explode(testPolygon);
for (var i = 0; i < points.features.length; i++) {
if (!booleanPointInPolygon(points.features[i], targetPolygon)) {
return false;
}
}
return true;
}
type: 'Feature',
geometry: geom,
properties: {}
};
if (inside(cent, f)) {
onSurface = true;
}
}
i++;
}
if (onSurface) {
return cent;
} else {
var vertices = featureCollection([]);
for (i = 0; i < fc.features.length; i++) {
vertices.features = vertices.features.concat(explode(fc.features[i]).features);
}
return nearest(cent, vertices);
}
}