openlayers实现绘制矩形查询

openlayers实现绘制矩形查询

功能说明

openlayers实现绘制矩形

代码如下

var layer=new ol.layer.Vector({
    source:new ol.source.Vector()
})
var draw = new ol.interaction.Draw({
                source: layer.getSource(),
                type: 'Circle',
                geometryFunction: ol.interaction.Draw.createBox()
            });
map.addInteraction(draw);
draw.on('drawend',function(e){
    var geom=e.feature.getGeometry();
})

You may also like...

1 Response

  1. I am truly thankful to the owner of this web site who has shared this fantastic piece of writing at at this place.

发表评论

您的电子邮箱地址不会被公开。

CAPTCHAis initialing...