如何使用OpenLayers旋转标记。我需要它是动态的而不是静态的:
这是我在component.ts文件中的代码
var size = new OpenLayers.Size(30, 30);
var offset = new OpenLayers.Pixel(-(size.w ), -size.h);
var icon = new OpenLayers.Icon('ship.PNG', size, offset);
var zoom = 3;
var fromProjection = new OpenLayers.Projection("EPSG:4326"); // Transform from WGS 1984
var toProjection = new OpenLayers.Projection("EPSG:900913"); // to Spherical Mercator Projection
var map = new OpenLayers.Map("map");
map.addLayer(new OpenLayers.Layer.OSM());
var lonLat = new OpenLayers.LonLat( -0.1279688 ,51.5077286 )
.transform(
new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
map.getProjectionObject() // to Spherical Mercator Projection
);
var markers = new OpenLayers.Layer.Markers( "Markers" );
map.addLayer(markers);
map.setCenter(new OpenLayers.LonLat(3, 56.1122).transform(fromProjection, toProjection), zoom);
/* var angle = 30;
function _rotate() {
markers.setIconAngle(angle);
angle = (angle + 10) % 360;
setTimeout(_rotate, 1000);
}
_rotate(); */
markers.addMarker(new OpenLayers.Marker(lonLat));