How to use @turf/point-on-feature - 2 common examples

To help you get started, we’ve selected a few @turf/point-on-feature 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 DoFabien / OsmGo / scripts / osmToOsmgo / index.js View on Github external
// console.log(feature)
        // stock the original geometry in  feature.properties.way_geometry  .way_geometry
        feature.properties.way_geometry = clone(feature.geometry);
        switch (feature.geometry.type) {
            case 'Polygon' || 'MultiPolygon':
                if (typeof area == 'function') { // bug esm  ? :s area.default
                    feature.properties['mesure'] = area(feature.geometry)
                }
                break;
            case 'LineString' || 'MultiLineString':
                if (typeof length == 'function') {
                    feature.properties['mesure'] = length(feature)
                }
                break;
        }
        feature.geometry = pointOnFeature(feature.geometry).geometry;
    }
}
github ghettovoice / vuelayers / src / ol-ext / geom.js View on Github external
export function findPointOnSurface (geom) {
  const simpleGeom = toSimpleGeom(geom)
  const pointFeature = pointOnFeature({
    type: simpleGeom.type || simpleGeom.getType(),
    coordinates: simpleGeom.coordinates || simpleGeom.getCoordinates(),
  })

  if (pointFeature && pointFeature.geometry) {
    return pointFeature.geometry.coordinates
  }
}

@turf/point-on-feature

turf point-on-feature module

MIT
Latest version published 3 years ago

Package Health Score

78 / 100
Full package analysis

Popular @turf/point-on-feature functions