AMapLoader.load({
key: '11111111111',
version: '2.0',
})
.then(AMap => {
// 初始化地图,
this.AMapHandler = AMap
this.map = new AMap.Map('map_container', {
viewMode: '3D',
zoom: 15
})
})
posDiff( name='江岸区') {
this.AMapHandler.plugin(['AMap.DistrictSearch'], () => {
// 创建行政区查询对象
var district = new this.AMapHandler.DistrictSearch({
// 返回行政区边界坐标等具体信息
extensions: 'all',
// 设置查询行政区级别为 区
level: 'district'
})
district.search(name, (status, result) => {
// 获取泉州市的边界信息
var bounds = result.districtList[0].boundaries
this.qh_path = bounds
})
})
},
compute(point) {
// 判断点再不是区县范围
var isPointInRing = this.AMapHandler.GeometryUtil.isPointInRing(point, this.qh_path)
return isPointInRing
},
//调用
this.compute([lng, lat])
网友评论