Rotate a feature Image in Open Layers

Posted by Ozaki on Stack Overflow See other posts from Stack Overflow or by Ozaki
Published on 2010-05-14T08:02:11Z Indexed on 2010/05/14 8:04 UTC
Read the original article Hit count: 298

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about openlayers