ol 之 判断点是否在面内
引用:
import { Feature } from 'ol'
import Polygon from 'ol/geom/Polygon';
代码:
// 地图上的不规则斑块 let wuxi = [ [ [120.57785099716335, 31.72873608773719], [120.58050299716332, 31.735581087737156], [120.57785099716335, 31.72873608773719] ] ] // 创建feature let polygonFeature = new Feature({ geometry: new Polygon(wuxi) }) let geo = polygonFeature.getGeometry() // 判断点是否在面内 let isIn = geo.intersectsCoordinate([ 129.5778509971633, 31.72873608773719 ]) console.log(isIn)
钻研不易,转载请注明出处。。。。。。