Refactorization of FiresMap
This commit is contained in:
parent
77b56e4169
commit
f6453c77d7
8 changed files with 150 additions and 128 deletions
15
imports/ui/components/Maps/Utils.js
Normal file
15
imports/ui/components/Maps/Utils.js
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
/* global L */
|
||||
// https://stackoverflow.com/questions/35394577/leaflet-js-union-merge-circles
|
||||
import union from '@turf/union';
|
||||
|
||||
export function unify(polyList) {
|
||||
let unionTemp;
|
||||
for (let i = 0; i < polyList.length; i += 1) {
|
||||
if (i === 0) {
|
||||
unionTemp = polyList[i].toGeoJSON();
|
||||
} else {
|
||||
unionTemp = union(unionTemp, polyList[i].toGeoJSON());
|
||||
}
|
||||
}
|
||||
return L.geoJson(unionTemp);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue