| | |
| | | } |
| | | |
| | | return request({ |
| | | url: '/system/gps/address/search', |
| | | // url: '/system/gps/address/search', |
| | | url: '/system/gps/tianditu/place/suggestion', |
| | | method: 'get', |
| | | params: { |
| | | keyword: keyword, |
| | |
| | | if (isNaN(lat) || isNaN(lng)) { |
| | | return Promise.reject(new Error('参数无效,经纬度坐标格式错误')) |
| | | } |
| | | |
| | | /** |
| | | * 这里用到天地图 |
| | | */ |
| | | return request({ |
| | | url: '/system/gps/address/geocoder', |
| | | // url: '/system/gps/address/geocoder', |
| | | url: '/system/gps/tianditu/reverseGeocoding', |
| | | method: 'get', |
| | | params: { |
| | | lat: lat, |
| | |
| | | }) |
| | | } |
| | | |
| | | export function calculateTianDiTuDistance(fromAddress, toAddress) { |
| | | // 参数验证 |
| | | if (!fromAddress || !toAddress) { |
| | | return Promise.reject(new Error('参数不完整,缺少地址')) |
| | | } |
| | | |
| | | return request({ |
| | | url: '/system/gps/tianditu/distance/byAddress', |
| | | method: 'get', |
| | | params: { |
| | | fromAddress: fromAddress, |
| | | toAddress: toAddress |
| | | } |
| | | }) |
| | | } |
| | | // 地图路线规划API(计算两点间距离) |
| | | export function calculateDistance(fromLat, fromLng, toLat, toLng) { |
| | | // 参数验证 |
| | |
| | | |
| | | return request({ |
| | | url: '/system/gps/route/distance', |
| | | // url: '/system/gps/tianditu/byAddress', |
| | | method: 'get', |
| | | params: { |
| | | fromLat: fromLat, |
| | |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // 别名,与baiduGeocoding功能相同 |
| | | export const baiduGeocode = baiduGeocoding |
| | | |
| | | // 百度地图路线规划API(计算两个坐标之间的驾车距离) |
| | | export function baiduRouteDriving(origin, destination) { |
| | |
| | | }) |
| | | } |
| | | |
| | | // 天地图地址搜索提示API(输入联想) |
| | | // 天地图普通搜索服务API(地址搜索) |
| | | export function tiandituPlaceSuggestion(keyWord, region, city, count) { |
| | | // 参数验证 |
| | | if (!keyWord) { |
| | |
| | | count: count || 10 |
| | | } |
| | | }) |
| | | } |
| | | } |