@polar/plugin-draw
Version:
Draw plugin for POLAR that adds draw interactions to the map, allowing users to place various shapes and texts.
17 lines (15 loc) • 479 B
text/typescript
import { FeatureCollection } from 'geojson'
import { booleanValid } from '@turf/boolean-valid'
import { GeometryType } from '../../types'
export const validateGeoJson = (
featureCollection: FeatureCollection<GeometryType>
): FeatureCollection<GeometryType> => ({
...featureCollection,
features: featureCollection.features.map((feature) => ({
...feature,
properties: {
...(feature.properties ?? {}),
sfaValidity: booleanValid(feature),
},
})),
})