Reputation: 1717
I have this piece of code in a template :
view: new ol.View({
center: ol.proj.fromLonLat([/*[[${center.longitude}]]*/, /*[[${center.latitude}]]*/]),
zoom: 14
})
this is the value of the object:
center [ Coordinate [latitude=41.33434906005859, longitude=1.8457042932510377]]
but when I see the source of the template I see this
view: new ol.View({
center: ol.proj.fromLonLat([[[${center.longitude}]], /*41.33434906005859*/]),
zoom: 14
})
Upvotes: 0
Views: 308
Reputation: 1148
Please assign the values into js variables first.
var centerLat = /*[[${center.longitude}]]*/;
var centerLng = /*[[${center.latitude}]]*/;
Then use it.
view: new ol.View({
center: ol.proj.fromLonLat([centerLng, centerLat]),
zoom: 5
})
Find the working code in here
Upvotes: 1