Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

Thanks in advance.

share|improve this question

2 Answers 2

I think you need to use :

layer.addFeatures(features)

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

share|improve this answer

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...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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