While working on Ground Overlays, I noticed that it has a tag called <rotation>
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<GroundOverlay>
<name>Large-scale overlay on terrain</name>
<visibility>1</visibility>
<description>Overlay shows Mount Etna erupting on July 13th, 2001.</description>
<Icon>
<href>http://kml-samples.googlecode.com/svn/trunk/resources/etna.jpg</href>
</Icon>
<LatLonBox>
<north>37.91904192681665</north>
<south>37.46543388598137</south>
<east>15.35832653742206</east>
<west>14.60128369746704</west>
<rotation>11.9556640799496235</rotation>
</LatLonBox>
</GroundOverlay>
</kml>
My question is – can an image layer be rotated in 2D view? Following is the code I am using to add an Image and set its bounding box.
var options = {
'opacity': 1.0,
'isBaseLayer': false,
numZoomLevels : 20
};
var image = new OpenLayers.Layer.Image(
groundOverlay.name,
groundOverlay.href,
new OpenLayers.Bounds( groundOverlay.west, groundOverlay.south, groundOverlay.east, groundOverlay.north),
new OpenLayers.Size(1, 1),
options
);
map.addLayers([image]);
Following the screen shot when above KML is displayed on my local system without rotation.
Google Maps does not seem to rotate the image, but Google Earth plugin does.
Best Answer
Openlayers can't display rotated images as Layer.Image. If you want to display rotated images, you can use as workaround a vector layer with point feature and externalGraphic.
Example of rotation:
http://openlayers.org/dev/examples/rotate-features.html
And example of rotation with graphic:
http://openlayers.org/dev/examples/styles-rotation.html
And description for external graphic
http://docs.openlayers.org/library/feature_styling.html