1. PoiGeocoder
地理编码与逆地理编码,通过地名地址获取对应的经纬度,通过经纬度获取地址
1.1. new PoiGeocoder(options)
Param | Type | Default | Description |
---|---|---|---|
options | Object |
包含以下参数的选项 |
|
[options.serviceName] | String |
‘高德’ |
采用的api接口名称,有天地图和高德两种 |
[options.token] | String |
{Amap:‘高德秘钥’,TDT:‘天地图秘钥’} |
设置天地图和高德接口的秘钥,不设则使用默认秘钥 |
Example
let poi = new BOSGeo.PoiGeocoder({serverName:’高德’
})
;
1.2. 属性
属性名 | Type | Default | Description |
---|---|---|---|
serviceName | String |
‘高德’ |
采用的api接口名称,有天地图和高德两种 |
1.3. 方法
1.3.1. poi.geocoding(input)
根据地址获取经纬度,利用高德或者天地图的地名搜索接口。
Param | Type | Description |
---|---|---|
input | String |
输入关键字 |
pois | Object |
含经纬度等的对象 |
Example
poi.geocoding(‘深圳’)
;
1.3.2. poi.reGeocoding(position)
根据经纬度获取地址
Param | Type | Description |
---|---|---|
position | Array |
经纬度数组 |
address | String |
地址 |
Example
let add = poi.reGeocoding([112, 23.5]);