Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 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;
}
}
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
}
}