地图路线 最后更新时间: 2024年08月30日
1、路线创建
请求地址:
url 请求参数
body请求参数
示例代码(以java为例)
import com.amap.wia.openapi.test.lib.MyHttpUtils;//见 https://lbs.amap.com/api/wia-openapi/guide/tools/demo-lib
import com.amap.wia.openapi.test.lib.SignatureHelper;//见 https://lbs.amap.com/api/wia-openapi/guide/tools/biz-token-sign
/*
* 通用 import 内容等暂略
*/
public static void main(String[] args) {
String requestUrl = "https://restwia.amap.com/api/v1/wia/map/line/create";
//url param
HashMap<String, Object> param1 = Maps.newHashMap();
param1.put("key", "在高德开放平台申请的key");
param1.put("openId", "当前操作用户的openId");
param1.put("bizToken", "在高德开放平台申请的bizToken");
param1.put("bizSign", SignatureHelper.calcSign("在高德开放平台申请的bizSecret",new String[]{"openId","bizToken"}));
//body
HashMap<String, Object> param2 = Maps.newHashMap();
param2.put("workMapId","工作地图id");
param2.put("title","测试路线");
ArrayList<Map<String,Object>> pointInfoList = Lists.newArrayList();
HashMap<String, Object> point01 = Maps.newHashMap();
point01.put("alias","资源点1");
HashMap<String, Object> pointInfo01 = Maps.newHashMap();
pointInfo01.put("name","马家楼桥");
pointInfo01.put("address","丰台区");
pointInfo01.put("lon","116.34544283151628");
pointInfo01.put("lat","39.83106224363813");
point01.put("pointInfo",pointInfo01);
pointInfoList.add(point01);
HashMap<String, Object> point02 = Maps.newHashMap();
point02.put("alias","资源点2");
HashMap<String, Object> pointInfo02 = Maps.newHashMap();
pointInfo02.put("name","大红门桥");
pointInfo02.put("address","丰台区");
pointInfo02.put("lon","116.40109866857532");
pointInfo02.put("lat","39.832299121918304");
point02.put("pointInfo",pointInfo02);
pointInfoList.add(point02);
param2.put("pointInfoList",pointInfoList);
param2.put("planRoute",true);
param2.put("navigationType",1);
// param2.put("iconColorValue","#FF6968,#F74746");
param2.put("sceneType",0);
requestUrl = MyHttpUtils.attachParamsToUrl(requestUrl,param1);
String s = MyHttpUtils.postApplicationJson(requestUrl, JSONObject.toJSONString(param2));
System.out.println("s = " + s);
}
入参实例
{
"workMapId": "B70bByvTOEPY0effRRsMuA",
"title": "路线规划-阳阳",
"pointInfoList": [
{
"alias":"浏阳市淳口镇长丰商店",
"pointInfo": {
"address": "湖南省长沙市浏阳市淳口镇鸭头村楼古集镇",
"lon": "113.5042160000613",
"name": "浏阳市淳口镇长丰商店",
"lat": "28.357623000019746"
}
},
{
"alias":"浏阳市淳口镇蕾蕾商店",
"pointInfo": {
"address": "湖南省长沙市浏阳市淳口镇鸭头村金盆组318号",
"lon": "113.50536575002431",
"name": "浏阳市淳口镇蕾蕾商店",
"lat": "28.359188500029557"
}
},
{
"alias":"浏阳市淳口镇胖哥商店",
"pointInfo": {
"address": "湖南省长沙市浏阳市淳口镇鸭头村新园组40号",
"lon": "113.50136333336512",
"name": "浏阳市淳口镇胖哥商店",
"lat": "28.365254333357832"
}
},
{
"alias":"浏阳市淳口镇熊家商店",
"pointInfo": {
"address": "湖南省长沙市浏阳市淳口镇鸭头村代新组30号",
"lon": "113.50141000004889",
"name": "浏阳市淳口镇熊家商店",
"lat": "28.365203666694605"
}
},
{
"alias":"浏阳市淳口镇鸭头村友友商店",
"pointInfo": {
"address": "湖南省长沙市浏阳市淳口镇鸭头村杉山组",
"lon": "113.50135933335014",
"name": "浏阳市淳口镇鸭头村友友商店",
"lat": "28.365211333350036"
}
},
{
"alias":"浏阳市淳口镇利民商店",
"pointInfo": {
"address": "湖南省长沙市浏阳市淳口镇鸭头村培上组53号",
"lon": "113.48869166665028",
"name": "浏阳市淳口镇利民商店",
"lat": "28.364809333344816"
}
},
{
"alias":"浏阳市淳口镇真好商店",
"pointInfo": {
"address": "湖南省长沙市浏阳市淳口镇鸭头村楼古集镇",
"lon": "113.48183933333078",
"name": "浏阳市淳口镇真好商店",
"lat": "28.36485133333542"
}
},
{
"alias":"浏阳市淳口镇周周商店",
"pointInfo": {
"address": "湖南省长沙市浏阳市淳口镇鸭头村永清组",
"lon": "113.48877699999574",
"name": "浏阳市淳口镇周周商店",
"lat": "28.36485533334698"
}
},
{
"alias":"浏阳市淳口镇大路商店",
"pointInfo": {
"address": "湖南省长沙市浏阳市淳口镇鸭头村肖家组",
"lon": "113.49237774999565",
"name": "浏阳市淳口镇大路商店",
"lat": "28.365811500008274"
}
},
{
"alias":"罗刚—湖南省浏阳市",
"pointInfo": {
"address": "湖南省长沙市浏阳市淳口镇鸭头村省埠片",
"lon": "113.49576524999868",
"name": "罗刚—湖南省浏阳市",
"lat": "28.364602000000392"
}
},
{
"alias":"浏阳市淳口镇长兴商店",
"pointInfo": {
"address": "湖南省长沙市浏阳市淳口镇鸭头村培元片",
"lon": "113.49378333337403",
"name": "浏阳市淳口镇长兴商店",
"lat": "28.371749666690363"
}
},
{
"alias":"浏阳市淳口镇卫秀商店",
"pointInfo": {
"address": "湖南省长沙市浏阳市淳口镇鸭头村",
"lon": "113.49371700000268",
"name": "浏阳市淳口镇卫秀商店",
"lat": "28.371795666667484"
}
},
{
"alias":"浏阳市淳口镇清支商店",
"pointInfo": {
"address": "湖南省长沙市浏阳市淳口镇鸭头村向荣组",
"lon": "113.49317933337858",
"name": "浏阳市淳口镇清支商店",
"lat": "28.372481000009657"
}
},
{
"alias":"浏阳市龙伏镇卫记商店",
"pointInfo": {
"address": "湖南省长沙市浏阳市龙伏镇坪上村",
"lon": "113.49319000000023",
"name": "浏阳市龙伏镇卫记商店",
"lat": "28.372436000000235"
}
},
{
"alias":"浏阳市龙伏镇晟旺商店",
"pointInfo": {
"address": "湖南省长沙市浏阳市龙伏镇焦桥村江边组",
"lon": "113.4914703333364",
"name": "浏阳市龙伏镇晟旺商店",
"lat": "28.384381000003916"
}
}
],
"planRoute": true,
"navigationType": 1,
"iconColorValue": "#7E97FF,#4265FF"
}
返回参数
响应结果的格式为 JSON 形式,以下是参数说明
返回示例
{
"data": {
"workMapId": "P3AOnftSzq7bdMTxw057Sg",
"resourceId": "2003003712473160"
},
"code": 1,
"message": "Successful",
"result": true,
"version": "1.0",
"timestamp": 1702451349548,
"requestId": "1eb5d13017024513445691002d1aec"
}
2、路线修改
请求地址:
url 请求参数
示例代码(以java为例)
import com.amap.wia.openapi.test.lib.MyHttpUtils;//见 https://lbs.amap.com/api/wia-openapi/guide/tools/demo-lib
import com.amap.wia.openapi.test.lib.SignatureHelper;//见 https://lbs.amap.com/api/wia-openapi/guide/tools/biz-token-sign
/*
* 通用 import 内容等暂略
*/
public static void main(String[] args) {
String requestUrl = "https://restwia.amap.com/api/v1/wia/map/line/update";
//url param
HashMap<String, Object> param1 = Maps.newHashMap();
param1.put("key", "在高德开放平台申请的key");
param1.put("openId", "当前操作用户的openId");
param1.put("bizToken", "在高德开放平台申请的bizToken");
param1.put("bizSign", SignatureHelper.calcSign("在高德开放平台申请的bizSecret",new String[]{"openId","bizToken"}));
//body
HashMap<String, Object> param2 = Maps.newHashMap();
param2.put("workMapId","工作地图id");
param2.put("resourceId","任务id");
param2.put("title","测试路线");
ArrayList<Map<String,Object>> pointInfoList = Lists.newArrayList();
HashMap<String, Object> point01 = Maps.newHashMap();
point01.put("alias","资源点1");
HashMap<String, Object> pointInfo01 = Maps.newHashMap();
pointInfo01.put("name","马家楼桥");
pointInfo01.put("address","丰台区");
pointInfo01.put("lon","116.34544283151628");
pointInfo01.put("lat","39.83106224363813");
point01.put("pointInfo",pointInfo01);
pointInfoList.add(point01);
HashMap<String, Object> point02 = Maps.newHashMap();
point02.put("alias","资源点2");
HashMap<String, Object> pointInfo02 = Maps.newHashMap();
pointInfo02.put("name","大红门桥");
pointInfo02.put("address","丰台区");
pointInfo02.put("lon","116.40109866857532");
pointInfo02.put("lat","39.832299121918304");
point02.put("pointInfo",pointInfo02);
pointInfoList.add(point02);
param2.put("pointInfoList",pointInfoList);
param2.put("planRoute",true);
param2.put("navigationType",1);
// param2.put("iconColorValue","#FF6968,#F74746");
param2.put("sceneType",0);
requestUrl = MyHttpUtils.attachParamsToUrl(requestUrl,param1);
String s = MyHttpUtils.postApplicationJson(requestUrl, JSONObject.toJSONString(param2));
System.out.println("s = " + s);
}
body请求参数
返回参数
响应结果的格式为 JSON 形式,以下是参数说明
返回示例
{
"data": tue,
"code": 1,
"message": "Successful",
"result": true,
"version": "1.0",
"timestamp": 1701142286019,
"requestId": "1eb5d12017011422856761177d14ca"
}
3、路线删除
请求地址:
url 请求参数
示例代码(以java为例)
import com.amap.wia.openapi.test.lib.MyHttpUtils;//见 https://lbs.amap.com/api/wia-openapi/guide/tools/demo-lib
import com.amap.wia.openapi.test.lib.SignatureHelper;//见 https://lbs.amap.com/api/wia-openapi/guide/tools/biz-token-sign
/*
* 通用 import 内容等暂略
*/
public static void main(String[] args) {
String requestUrl = "https://restwia.amap.com/api/v1/wia/map/line/delete";
//url param
HashMap<String, Object> param1 = Maps.newHashMap();
param1.put("key", "在高德开放平台申请的key");
param1.put("openId", "当前操作用户的openId");
param1.put("bizToken", "在高德开放平台申请的bizToken");
param1.put("bizSign", SignatureHelper.calcSign("在高德开放平台申请的bizSecret",new String[]{"openId","bizToken"}));
//body
HashMap<String, Object> param2 = Maps.newHashMap();
param2.put("workMapId","工作地图id");
param2.put("resourceId","任务id");
requestUrl = MyHttpUtils.attachParamsToUrl(requestUrl,param1);
String s = MyHttpUtils.postApplicationJson(requestUrl, JSONObject.toJSONString(param2));
System.out.println("s = " + s);
}
body请求参数
返回参数
响应结果的格式为 JSON 形式,以下是参数说明
返回示例
{
"data": true,
"code": 1,
"message": "Successful",
"result": true,
"version": "1.0",
"timestamp": 1708511483526,
"requestId": "1eb5d11517085114640361002d38a4"
}
附件
pointInfoList详细参数说明