Merge pull request #1868 from umap-project/fix-layer-old-storage

fix: support old storage options when importing a umap file
This commit is contained in:
Yohan Boniface 2024-05-30 16:14:45 +02:00 committed by GitHub
commit 88103f284a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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)
}) })