[OpenLayers-Users] openlayer markers located at the wrong place

Mario Danelli mario.danelli at gmail.com
Fri May 31 02:18:10 PDT 2013


Dear Maven,

> `OpenLayers.Marker` have no native support methods like `setPosition()` 
> or something else to update its position.
> 
> Since in my opinion, destroy-create-destroy.. will be a performance
consuming problem, that is why I keep one object of  `Marker` to reuse it.
> 

I found a solution.

It seems the problem isn't in the "moveTo" function but what is passed to it.

I just tried the following new "updateMarker" version and it works as expected.

----------------> BEGIN 

function updateMaker(myMarkerIn, pos) {
myMarkerIn.moveTo(map.getLayerPxFromViewPortPx(map.getPixelFromLonLat(pos)));
}

<---------------- END

Regards

Mario Danelli 




More information about the Users mailing list