Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_pointInMask(lon, lat) {
const pt = {
type: 'Feature',
geometry: {
type: 'Point',
coordinates: [lon, lat] // geojson, lon-lat order !
},
properties: {}
};
const poly = this._spatialMask;
return inside(pt, poly);
}
hop =>
inside(point([hop[0].stop_lon, hop[0].stop_lat]), polygon) &&
inside(point([hop[1].stop_lon, hop[1].stop_lat]), polygon)
)
hop =>
inside(point([hop[0].stop_lon, hop[0].stop_lat]), polygon) &&
inside(point([hop[1].stop_lon, hop[1].stop_lat]), polygon)
)
const insidePolygon = (polygon) => (stop) => inside(point([stop.stop_lon, stop.stop_lat]), polygon)
const toId = (stop) => stop.stop_id
y2 = line[k + 1][1];
if (pointOnSegment(x, y, x1, y1, x2, y2)) {
onLine = true;
onSurface = true;
}
k++;
}
j++;
}
} else if (geom.type === 'Polygon' || geom.type === 'MultiPolygon') {
var f = {
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);
}
}
.filter((feature) => {
const point = {
type: 'Feature',
geometry: {
type: 'Point',
coordinates: [
latlng.lng,
latlng.lat
]
}
}
return turfInside(point, feature)
})