Appearance
isCoordInRegion
▸ isCoordInRegion(options
): Promise
<boolean
>
判断给定坐标是否在某地
fetch url: ${host}/geojson/bound/${regionCode}.json
参数
Name | Type | Description |
---|---|---|
options | Object | |
options.latitude | number | 纬度 |
options.longitude | number | 经度 |
options.regionCode | string | 区域码 |
返回值
Promise
<boolean
>
示例
js
const location = await uni.getLocation()
// 判断当前坐标在是否处于广东省
isCoordInRegion({...location, regionCode: '440000'})
// 判断当前坐标在是否处于广东省广州市
isCoordInRegion({...location, regionCode: '440100'})
// 判断当前坐标在是否处于广东省广州市海珠区
isCoordInRegion({...location, regionCode: '440105'})