Commit e47b6d52 by liimin

0.1.5

1 parent 14bee6f5
{ {
"name": "glsx-map-sdk", "name": "glsx-map-sdk",
"version": "0.1.4", "version": "0.1.5",
"description": "glsx-map-sdk", "description": "glsx-map-sdk",
"main": "src/index.js", "main": "src/index.js",
"scripts": { "scripts": {
......
...@@ -20,7 +20,7 @@ class GlMapApi { ...@@ -20,7 +20,7 @@ class GlMapApi {
* @param {*} type 0:直线距离 , 1:驾车导航距离(仅支持国内坐标) , 3:步行规划距离(仅支持5km之间的距离) * @param {*} type 0:直线距离 , 1:驾车导航距离(仅支持国内坐标) , 3:步行规划距离(仅支持5km之间的距离)
* @returns {Promise<{elements: Array}>} * @returns {Promise<{elements: Array}>}
*/ */
async calculateDistance (from, to, type = 1) { async calculateDistance(from, to, type = 1) {
try { try {
const destination = JSON.parse(JSON.stringify(from)).reverse().join(','), const destination = JSON.parse(JSON.stringify(from)).reverse().join(','),
origins = JSON.parse(JSON.stringify(to)).reverse().join(','), origins = JSON.parse(JSON.stringify(to)).reverse().join(','),
...@@ -43,7 +43,7 @@ class GlMapApi { ...@@ -43,7 +43,7 @@ class GlMapApi {
* @param {*} type 直线距离 , 1:驾车导航距离(仅支持国内坐标) , 3:步行规划距离(仅支持5km之间的距离) * @param {*} type 直线距离 , 1:驾车导航距离(仅支持国内坐标) , 3:步行规划距离(仅支持5km之间的距离)
* @returns {Promise<{rows: Array}>} * @returns {Promise<{rows: Array}>}
*/ */
async calculateDistanceMatrix (from, toList, type = 1) { async calculateDistanceMatrix(from, toList, type = 1) {
try { try {
const destination = JSON.parse(JSON.stringify(from)).reverse().join(','), const destination = JSON.parse(JSON.stringify(from)).reverse().join(','),
origins = JSON.parse(JSON.stringify(toList)) origins = JSON.parse(JSON.stringify(toList))
...@@ -72,7 +72,7 @@ class GlMapApi { ...@@ -72,7 +72,7 @@ class GlMapApi {
* @param {*} address (String) * @param {*} address (String)
* @returns * @returns
*/ */
geocoder (address) { geocoder(address) {
return this.request.get('/v3/geocode/geo', { return this.request.get('/v3/geocode/geo', {
address address
}) })
...@@ -82,7 +82,7 @@ class GlMapApi { ...@@ -82,7 +82,7 @@ class GlMapApi {
* @param {*} location [lat<纬度>,lng<经度>] * @param {*} location [lat<纬度>,lng<经度>]
* @returns * @returns
*/ */
async detailedAdrress (location) { async detailedAdrress(location) {
try { try {
const [lat, lng] = location const [lat, lng] = location
const { regeocode } = await this.request.get('/v3/geocode/regeo', { const { regeocode } = await this.request.get('/v3/geocode/regeo', {
...@@ -134,7 +134,7 @@ class GlMapApi { ...@@ -134,7 +134,7 @@ class GlMapApi {
* IP定位 * IP定位
* @returns * @returns
*/ */
getLocationByIp () { getLocationByIp() {
return this.request.get('/v3/ip') return this.request.get('/v3/ip')
} }
/** /**
...@@ -147,7 +147,7 @@ class GlMapApi { ...@@ -147,7 +147,7 @@ class GlMapApi {
autonavi(不进行转换)) autonavi(不进行转换))
* @returns * @returns
*/ */
translate (locationsList, coordsys = 'autonavi') { translate(locationsList, coordsys = 'autonavi') {
// 使用数组解构和map方法,将locationsList参数转换为字符串,并反转数组顺序,然后用竖线连接,得到locations字符串 // 使用数组解构和map方法,将locationsList参数转换为字符串,并反转数组顺序,然后用竖线连接,得到locations字符串
const locations = JSON.parse(JSON.stringify(locationsList)) const locations = JSON.parse(JSON.stringify(locationsList))
.map(e => (e = e.reverse())) .map(e => (e = e.reverse()))
...@@ -166,7 +166,7 @@ class GlMapApi { ...@@ -166,7 +166,7 @@ class GlMapApi {
* @param {*} type 出行类型 1步行 2骑车 3驾车 * @param {*} type 出行类型 1步行 2骑车 3驾车
*/ */
async routePlanning (from, to, type = 3) { async routePlanning(from, to, type = 3) {
const funName = { const funName = {
1: '/v3/direction/walking', 1: '/v3/direction/walking',
2: '/v4/direction/bicycling', 2: '/v4/direction/bicycling',
...@@ -189,7 +189,7 @@ class GlMapApi { ...@@ -189,7 +189,7 @@ class GlMapApi {
* @param {*} keywords 查询关键词 * @param {*} keywords 查询关键词
* @param {*} location 定位坐标 [lat,lng] 纬度前,经度后 * @param {*} location 定位坐标 [lat,lng] 纬度前,经度后
*/ */
async keywordSearch (keywords, location) { async keywordSearch(keywords, location) {
try { try {
const { route } = await this.request.get('/v3/assistant/inputtips', { const { route } = await this.request.get('/v3/assistant/inputtips', {
keywords, keywords,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!