Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
street_layers.eachLayer(function(street_layer) {
status_update("Removing superfluous units from streets. Checking street " + i + " of " + street_layers.count() + "...");
let street_feature = street_layer.feature;
for (let unit_feature of processed_unit_features) {
let intersection_exists = lineIntersect(street_feature, unit_feature).features.length > 0;
if (intersection_exists) {
processed_unit_features.splice(processed_unit_features.indexOf(unit_feature), 1, null);
}
}
processed_unit_features = processed_unit_features.filter(feature => feature === null ? false : true);
i++;
});
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) {}
}
street_layers.eachLayer(function(street_layer) {
let street_feature = street_layer.feature;
for (let unit_feature of processed_unit_features) {
let intersection_exists = lineIntersect(street_feature, unit_feature).features.length > 0;
if (intersection_exists) {
processed_unit_features.splice(processed_unit_features.indexOf(unit_feature), 1, null);
}
}
processed_unit_features = processed_unit_features.filter(feature => feature === null ? false : true);
});