- KML支持
- GML支持
- Vector支持,当然是前面的基础
- 还有,矢量编辑支持
KML支持:
代码:
map.addLayer(new OpenLayers.Layer.GML("KML", "kml/mc-search.kml", {format: OpenLayers.Format.KML})); |
矢量编辑:
代码中只需要增加一个绘制的Control就可以了:
drawControls = { point: new OpenLayers.Control.DrawFeature(pointLayer, OpenLayers.Handler.Point), line: new OpenLayers.Control.DrawFeature(lineLayer, OpenLayers.Handler.Path, options), polygon: new OpenLayers.Control.DrawFeature(polygonLayer, OpenLayers.Handler.Polygon, options) }; |
然后激活某个控件就可以了:
control.activate(); |
简单的说:
vlayer = new OpenLayers.Layer.Vector( "Editable" ); map.addLayer(vlayer); map.addControl(new OpenLayers.Control.EditingToolbar(vlayer)); |
是不是看起来很美,至少自己看来,OSGeo的那些 开源 软件, OpenLayer 确实是一个比较有创意,有灵感的东西。以这个东西为基础,也许会有很多很有意思的新应用。