Search code examples
vuejs3openlayers

Vue3 + OpenLayers. Not showing map unless drag and drop event occurs


enter image description here

Given the following Vue3 code, I dont know why but my map only loads as expected after I drag and drop otherwise its shown as an empty map (It only shows OpenLayer map component with its zoom in - zoom out buttons but content empty unless I drag it).


Solution

  • I just found the problem. It was actually really simple, the thing is that the View of the Map expect for its property "center" an array with this format:

    [number, number]

    but I was sending:

    [string, string]

    That's why originally it was not showing anything but when I moved the center manually it got updated to a proper value and then properly shown.