Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var bboxWidth = (east - west);
var bboxHeight = (north - south);
var columns = Math.floor(bboxWidth / cellWidth);
var rows = Math.floor(bboxHeight / cellHeight);
// adjust origin of the grid
var deltaX = (bboxWidth - columns * cellWidth) / 2;
var deltaY = (bboxHeight - rows * cellHeight) / 2;
var currentX = west + deltaX;
while (currentX <= east) {
var currentY = south + deltaY;
while (currentY <= north) {
var cellPt = point([currentX, currentY], properties);
if (mask) {
if (within(cellPt, mask)) results.push(cellPt);
} else {
results.push(cellPt);
}
currentY += cellHeight;
}
currentX += cellWidth;
}
return featureCollection(results);
}
return (fieldPolygon: any) => within(fieldPolygon, queryPolygon);
}
function verifyFeature(geometry, boundingBox) {
try {
if (geometry.type == 'Point') {
return geometry;
} else if (geometry.type == 'LineString') {
var intersect = LineIntersect(geometry, boundingBox.toGeoJSON().geometry);
if (intersect.features.length) {
return geometry;
} else if (BooleanWithin(geometry, boundingBox.toGeoJSON().geometry)) {
return geometry;
}
} else if (geometry.type == 'Polygon') {
var polyIntersect = Intersect(geometry, boundingBox.toGeoJSON().geometry);
if (polyIntersect) {
return geometry;
} else if (BooleanWithin(geometry, boundingBox.toGeoJSON().geometry)) {
return geometry;
}
}
} catch (e) {}
}
function verifyFeature(geometry, boundingBox) {
try {
if (geometry.type == 'Point') {
return geometry;
} else if (geometry.type == 'LineString') {
var intersect = LineIntersect(geometry, boundingBox.toGeoJSON().geometry);
if (intersect.features.length) {
return geometry;
} else if (BooleanWithin(geometry, boundingBox.toGeoJSON().geometry)) {
return geometry;
}
} else if (geometry.type == 'Polygon') {
var polyIntersect = Intersect(geometry, boundingBox.toGeoJSON().geometry);
if (polyIntersect) {
return geometry;
} else if (BooleanWithin(geometry, boundingBox.toGeoJSON().geometry)) {
return geometry;
}
}
} catch (e) {}
}