Skip to content
Snippets Groups Projects
Commit 03f00f81 authored by Timothee P's avatar Timothee P :sunflower:
Browse files

add features to map, working with datas from django

parent 895b5a44
No related branches found
No related tags found
No related merge requests found
...@@ -259,6 +259,7 @@ const mapUtil = { ...@@ -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)) { 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.geometry);
//const geomJSON = flip(feature.geom); //* different name in data from django api
const popupContent = this._createContentPopup(feature); const popupContent = this._createContentPopup(feature);
......
...@@ -91,7 +91,11 @@ const feature = { ...@@ -91,7 +91,11 @@ const feature = {
.then((response) => { .then((response) => {
const features = response.data.features; const features = response.data.features;
commit("SET_FEATURES", 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) => { .catch((error) => {
throw error; throw error;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment