Rotate a feature programatically Open Layers

Posted by Ozaki on Stack Overflow See other posts from Stack Overflow or by Ozaki
Published on 2010-05-06T04:00:31Z Indexed on 2010/05/06 4:08 UTC
Read the original article Hit count: 415

TLDR I want to rotate a Feature in my open layers.
I want it to face a certain heading that I am receiving from server.


I know that you can make a feature spin on a point or so on:

window.setInterval(function() {rotateFeature(
       pointFeature, 360 / 20, origin)}, 100);

as from the open layers example.

But I want to be able to face it towards a heading I am given, so.

  1. Can I face a feature towards a heading?
  2. Can I face a feature(image) in the same way?
  3. If not is it possible to automatically calculate the rotation required and position it that way?
  4. Or any ideas on how I could do this with the image? (hoping not to have 360 images)

Thanks in advance.

© Stack Overflow or respective owner

Related posts about openlayers

Related posts about feature