2020-04-14 10:24:30 +02:00
|
|
|
export default function createFeatureCollection(latLngs) {
|
|
|
|
return {
|
2018-10-13 10:55:40 +02:00
|
|
|
type: 'FeatureCollection',
|
|
|
|
features: latLngs.map(featurePolygonLatLngs)
|
2020-04-14 10:24:30 +02:00
|
|
|
};
|
2018-10-13 10:55:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function featurePolygonLatLngs(latLngs) {
|
|
|
|
return {
|
|
|
|
type: 'Feature',
|
2020-04-14 10:24:30 +02:00
|
|
|
properties: {
|
|
|
|
source: 'selection_utilisateur'
|
|
|
|
},
|
2018-10-13 10:55:40 +02:00
|
|
|
geometry: {
|
|
|
|
type: 'Polygon',
|
|
|
|
coordinates: [latLngs.map(({ lng, lat }) => [lng, lat])]
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|