Can't load axios data #113
Unanswered
SolimanGit
asked this question in
Q&A
Replies: 1 comment
-
Update: I tried a new way to add features And the type of the feature is not reconized, surely undefined, i don't know why |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey i wanted to know how to add features with loader on Vector layers, i think i did it but an error occured :
vue3-openlayers.es.js:17674 Uncaught (in promise) TypeError: feature2.getId is not a function at VectorSource2.addToIndex_ (vue3-openlayers.es.js:17674:23) at VectorSource2.addFeaturesInternal (vue3-openlayers.es.js:17699:16) at VectorSource2.addFeatures (vue3-openlayers.es.js:17689:10) at VectorSource2.loadPointFeatures [as loader_] (Map.vue:238:44)
Here is my function loader for vector layer :
async function loadPointFeatures(){ const response_result = await axios.get('http://127.0.0.1:8000/stations'); if (response_result) { console.log(response_result) console.log(geometryPoint.value.values_.source) geometryPoint.value.values_.source.addFeatures(response_result.data[0].features); } }
Weird enough the error is on the second feature, here is the features :
As you can see only a point is labeled.
Thank you
Beta Was this translation helpful? Give feedback.
All reactions