in scripts/clean-geom.js [51:83]
function makeValid(feature) {
const writer = new GeoJSONWriter();
const newFeature = {
type: 'Feature',
geometry: null,
properties: feature.properties,
};
if (feature.id) newFeature.id = feature.id;
const isSimple = new IsSimpleOp(feature.geometry);
const isValid = new IsValidOp(feature.geometry);
if (!isSimple.isSimple() || !isValid.isValid()) {
if (!isValid.isValid()) {
log(`Feature [${feature.id}] is invalid`);
}
const geom = BufferOp.bufferOp(feature.geometry,0);
const geomArea = geom.getArea();
if (geomArea === 0) {
log(`New geometry is empty!!`);
} else {
log(`New geometry area: ${geomArea}`)
}
newFeature.geometry = writer.write(geom);
} else {
newFeature.geometry = writer.write(feature.geometry);
}
return newFeature;
}