openlayer 判断一个点是不是在一个面内

获取的到的是面的数据格式是在这里插入图片描述
需要先转成polygon。

let _points = JSON.parse(that.hotZone).coordinates
    this.polygonFeature = new Feature({
    geometry: new Polygon(_points)
})

然后在点击map的singleclick里面

	let geo = that.polygonFeature.getGeometry()
	that.isIn = geo.intersectsCoordinate(that.clickPoint);   // clickPoint为map点击的座标
	if(that.isIn) {
    console.log("该mark点在当前几何元素里。");
}`
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章