ghettovoice / vuelayers

Web map Vue components with the power of OpenLayers
https://vuelayers.github.io/
MIT License
680 stars 227 forks source link

getVectorContext not found in 'ol/render' #334

Closed Black-Horse closed 4 years ago

Black-Horse commented 4 years ago

Hi!

I am trying to recreate the custom animation example: https://openlayers.org/en/master/examples/feature-animation.html

However, on import { getVectorContext } from 'ol/render' I get getVectorContext not found in 'ol/render'.

Any hint on what I am doing wrong? Cheers!

empereira commented 4 years ago

Hello,

Maybe only: import { VectorContext } from 'ol/render'?

I looked in the ol/render folder and there is no getVectorContext.

Black-Horse commented 4 years ago

Thanks for your help! Unfortunately, it also doesn't find it: VectorContext not found in 'ol/render'

empereira commented 4 years ago

Ok, I'll ask even though you may have already done that, but did you install the "ol" package? :)

Black-Horse commented 4 years ago

You were right. yarn add ol helped. Now it finds getVectorContext. However, after installing this, a simple is no longer visible. When I yarn remove ol it draws again. Do you have another hint?

ghettovoice commented 4 years ago

Hi there! @Black-Horse I guess you use vuelayers v0.11.x and install latest ol v6.x.x version. Current vuelayers v0.11 works only with ol v5. Now you have to ways:

  1. remove node_modules/ol and node_modules/vuelayers and re-install with ol v5. Then use https://openlayers.org/en/v5.3.0/examples/feature-animation.html as example. And also transformed to vuelayers example from demo https://github.com/ghettovoice/vuelayers-demo/blob/master/src/App.vue#L343
  2. try new vuelayers v0.12 based on ol v6. install npm i vuelayers@next. And try to migrate ol animation example for yourself. This shouldn't be very hard, because vuelayers v0.12 have same events addfeature
Black-Horse commented 4 years ago

Thank you so much for your help! I chose 1. and adapted according to the example! It works nicely! 👍