How to use @turf/inside - 6 common examples

To help you get started, we’ve selected a few @turf/inside examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github IHCantabria / Leaflet.CanvasLayer.Field / src / Field.js View on Github external
_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);
    }
github conveyal / analysis-ui / lib / components / modifications-map / hop-select-polygon.js View on Github external
hop =>
            inside(point([hop[0].stop_lon, hop[0].stop_lat]), polygon) &&
            inside(point([hop[1].stop_lon, hop[1].stop_lat]), polygon)
        )
github conveyal / analysis-ui / lib / components / modifications-map / hop-select-polygon.js View on Github external
hop =>
            inside(point([hop[0].stop_lon, hop[0].stop_lat]), polygon) &&
            inside(point([hop[1].stop_lon, hop[1].stop_lat]), polygon)
        )
github conveyal / analysis-ui / lib / components / scenario-map / stop-select-single.js View on Github external
const insidePolygon = (polygon) => (stop) => inside(point([stop.stop_lon, stop.stop_lat]), polygon)
const toId = (stop) => stop.stop_id
github Turfjs / turf / packages / turf-point-on-surface / index.js View on Github external
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);
    }
}
github nypl-spacetime / maps-by-decade / app / containers / HoverMap / index.js View on Github external
.filter((feature) => {
        const point = {
          type: 'Feature',
          geometry: {
            type: 'Point',
            coordinates: [
              latlng.lng,
              latlng.lat
            ]
          }
        }
        return turfInside(point, feature)
      })

@turf/inside

turf inside module

MIT
Latest version published 7 years ago

Package Health Score

67 / 100
Full package analysis

Popular @turf/inside functions