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.
- Can I face a feature towards a heading?
- Can I face a feature(image) in the same way?
- If not is it possible to automatically calculate the rotation required and position it that way?
- Or any ideas on how I could do this with the image? (hoping not to have 360 images)
An example or such would be appreciated :D
Thanks in advance.
No luck so far using:
window.setInterval(function() {rotateFeature(
imagefeature, 150 / 360, origin)}, 1000);
function rotateFeature(feature, angle, origin) {
feature.geometry.rotate(angle, origin);
}
Where origin is the centeroid of the image object.
Any ideas code side?