Rotate a feature Image in Open Layers
- by Ozaki
I have an open layers map.
It adds and removes my "imageFeature" every 10secs or so.
I have a JSON feed that gives me the rotation that I need,
I have a request to get that rotation and set it as a variable of rotationv.
Everything works but the fact when the image is recreated it does not update the rotation.
My code is as follows:
JSON request:
var rotationv = (function () {
rotationv = null;
$.ajax({
'async': false,
'global': true,
'url': urldefault,
'dataType': "json",
'success': function (data) {
rotationv = data.rotation;
}
});
return rotationv
})();
Creating image feature:
imageFeature = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Point(mylon, mylat), { rotation: rotationv }
);
The image is set in the styling elsewhere. Why does this not rotate my image?