2

I have an SVG image and I want to rotate it around itself. So I do the following:

var origin = new OpenLayers.Geometry.Point(vertices[0].x,vertices[0].y);            
feature.geometry.rotate(90 ,origin);
feature.layer.drawFeature(feature);

but nothing happens. Does anyone know why?

1

I think you need to use :

layer.addFeatures(features)

Check this example : http://openlayers.org/dev/examples/styles-rotation.html

1

dont try it with point, you cant understand your obj. rotate or not...this code is for linestring and works good.

var line = new OpenLayers.Feature.Vector(
                new OpenLayers.Geometry.LineString(points),null,null);
vector.addFeatures([line]);

var origin = new OpenLayers.Geometry.Point(10, 10);

line.geometry.rotate(30, origin);
line.layer.drawFeature(line);

i hope it helps you...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.