fix: support old storage options when importing a umap file

This commit is contained in:
Yohan Boniface 2024-05-30 14:12:18 +02:00
parent 7f3149af08
commit 5f5805dc09

View file

@ -877,7 +877,11 @@ U.Map = L.Map.extend({
if (importedData.geometry) this.options.center = this.latLng(importedData.geometry) if (importedData.geometry) this.options.center = this.latLng(importedData.geometry)
const self = this const self = this
importedData.layers.forEach((geojson) => { importedData.layers.forEach((geojson) => {
delete geojson._umap_options['id'] // Never trust an id at this stage if (!geojson._umap_options && geojson._storage) {
geojson._umap_options = geojson._storage
delete geojson._storage
}
delete geojson._umap_options?.id // Never trust an id at this stage
const dataLayer = self.createDataLayer(geojson._umap_options) const dataLayer = self.createDataLayer(geojson._umap_options)
dataLayer.fromUmapGeoJSON(geojson) dataLayer.fromUmapGeoJSON(geojson)
}) })