Openlayers ol.interaction.Modify 获取修改之后的坐标数据

背景

在Openlayers中, 我们可以添加可编辑的点, 线, 多边形对象, 也可以拿到编辑结束后的回调事件, 但是在官方文档中, (应该是我疏忽)并没有找到在编辑完成的事件中, 怎么获取到编辑之后的经纬度数据, 经过自己调试, 找到了对应的取值地方.

添加修改对象

this.modify = new ol.interaction.Modify({source: this.modify_source});

map.addInteraction(this.modify);

this.modify.on('modifyend', this.ModifyIconEnd);

都是在modifyend对应的回调方法中,获取到修改之后的经纬度数据

this.ModifyIconEnd =function(evt){

var extent = evt.features.item(0).getGeometry().getCoordinates()

}

其中extent就是修改后的坐标

线

this.ModifyLineEnd = function(evt){

var extent = evt.features.item(0).getGeometry().getCoordinates()

}

其中extent就是修改后的坐标

多边形

this.ModifyPolygonEnd = function(evt){

var extent = evt.features.item(0).getGeometry().getCoordinates()[0];

};

其中extent就是修改后的坐标

你可能感兴趣的:(Openlayers ol.interaction.Modify 获取修改之后的坐标数据)