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])
高德地图判断坐标点,是否在某一个区县
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 前言 当 Redis 用作缓存时,其目的就是为了减少数据库访问频率,降低数据库压力,但是假如我们某些数据并不存在于...
- 做项目时候,经常遇到在地图上画范围内的车辆、点位等等,如某重要点位直径300米内的所有车辆,等类似的,很多时候都是...