创建如何可以在OpenStreetMap的阻力markar新的矢量层:
Layer.MARKER = new OpenLayers.Layer.Vector("Marker Layers", {
styleMap: new OpenLayers.StyleMap({
'default': {
externalGraphic: "${URL}",
graphicWidth:50,//pixel
graphicHeight:50//pixel
}
}
)
});
新增地图:
map.addLayer(Layer.MARKER);
将控制添加
Control.DragText = new OpenLayers.Control.DragFeature(Layer.MARKER);
map.addControl(Control.DragText);
激活控制:
Control.DragText.activate();
//Deactive Control.DragText.deactivate();
最后添加标记:
var marker= new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(lon, lat));
marker.attributes = {
URL: "marker_url"
};
Layer.MARKER.addFeatures([marker]);
形容 “不正常”。 – scai