From 03f00f819bfd3ecbdbf46dc7b23ef548a91e1139 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Poussard?= <tpoussard@neogeo.fr> Date: Mon, 6 Sep 2021 17:57:29 +0200 Subject: [PATCH] add features to map, working with datas from django --- src/assets/js/map-util.js | 1 + src/store/modules/feature.js | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/assets/js/map-util.js b/src/assets/js/map-util.js index 49e73386..23023676 100644 --- a/src/assets/js/map-util.js +++ b/src/assets/js/map-util.js @@ -259,6 +259,7 @@ const mapUtil = { if (!filter || !Object.values(filter).some(val => val) || Object.values(filter).some(val => val) && filters.length && filters.every(val => val !== false)) { const geomJSON = flip(feature.geometry); + //const geomJSON = flip(feature.geom); //* different name in data from django api const popupContent = this._createContentPopup(feature); diff --git a/src/store/modules/feature.js b/src/store/modules/feature.js index 3b4f8ebb..e0ef78f0 100644 --- a/src/store/modules/feature.js +++ b/src/store/modules/feature.js @@ -91,7 +91,11 @@ const feature = { .then((response) => { const features = response.data.features; commit("SET_FEATURES", features); - dispatch("map/ADD_FEATURES", features, { root: true }); + dispatch("map/ADD_FEATURES", features.map(el => { + const geometry = el.geom; + const properties = { ...el } + return { geometry, properties } + }), { root: true }); }) .catch((error) => { throw error; -- GitLab