地图纬度自定义字段 最后更新时间: 2024年08月30日
产品简介
地点资源支持管理员配置自定义字段,用于满足客户的个性化需求。
使用限制
详细的服务调用量限制可点我查阅。
使用说明
接收请求返回的数据(JSON或XML格式),参考返回参数文档解析数据。
如无特殊声明,接口的输入参数和输出数据编码全部统一为 UTF-8 编码方式。
功能使用说明
- 在地图内使用自定义字段,分为如下几步
- 在地图内创建需要使用的字段(批量新增自定义字段接口)
- 在地图内创建字段分组(自定义字段分组新增接口)
- 查询地图内已创建的自定义字段(分页查询自定义字段接口)
- 『创建点资源』或者『修改点资源』时,传入自定义字段分组id(dimensionId)及自定义字段相应的key-vlaue 值
1. 批量新增自定义字段
请求地址
特别注意:请求格式 表单
请求参数
componentCreate 说明:
示例代码(以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 url = "https://restwia.amap.com/api/v1/wia/dimension/component/batch/create";
String key = "在高德开放平台申请的key";
String openId = "当前操作用户的openId";
String workMapId ="要操作的工作地图id";
String bizToken = "在高德开放平台申请的bizToken";
String bizSecret = "在高德开放平台申请的bizSecret";
Integer dimensionType = 1;
Map<String, Object> requestParams = new HashMap<>();
requestParams.put("key", key);
requestParams.put("openId", openId);
requestParams.put("workMapId", workMapId);
requestParams.put("bizToken", bizToken);
String[] signArgs = new String[]{workMapId,dimensionType.toString()};
requestParams.put("bizSign", SignatureHelper.calcSign(bizSecret, signArgs));
Map<String, Object> postParams = new HashMap<>();
postParams.put("dimensionType", dimensionType);
postParams.put("componentCreate", "{\"componentList\":[{\"viewText\":\"自定义拜访时间\",\"componentType\":4},{\"optionList\":[\"少年\",\"青年\",\"中年\",\"老年\"],\"viewText\":\"自定义多选客群\",\"componentType\":3},{\"optionList\":[\"男\",\"女\",\"保密\"],\"viewText\":\"自定义性别单选\",\"componentType\":2},{\"viewText\":\"自定义文本框1\",\"componentType\":1}]}");
url = MyHttpUtils.attachParamsToUrl(url, requestParams);
String response = MyHttpUtils.postFormUrlencoded(url, postParams);
System.out.println(response);
}
返回参数
返回结果示例
{
"data": {
"componentList": [{
"componentId": "326002010001027",
"componentType": 1,
"itemIdList": ["426002011504027"]
}, {
"componentId": "326000001560027",
"componentType": 2,
"itemIdList": ["4260010001506027"]
}, {
"componentId": "3202010001562",
"componentType": 3,
"itemIdList": ["4260020100006029"]
}, {
"componentId": "3600210056030",
"componentType": 4,
"itemIdList": ["460020101500"]
}]
},
"code": 1,
"message": "Successful",
"result": true,
"version": "1.0",
"timestamp": 1693213834699,
"requestId": "1eb433b1693218866104d3ef2"
}
2. 批量修改自定义字段
请求地址
特别注意:请求格式 表单
请求参数
componentUpdate 说明:
示例代码(以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 url = "https://restwia.amap.com/api/v1/wia/dimension/component/batch/update";
Map<String, Object> params = new HashMap<>();
String workMapId = "工作地图id";
Integer dimensionType = 1;
params.put("key", "在高德开放平台申请的key");
params.put("openId", "当前操作用户的openId");
params.put("bizToken", "在高德开放平台申请的bizToken");
params.put("workMapId", workMapId);
String[] signArgs = new String[]{workMapId, String.valueOf(dimensionType)};
params.put("bizSign", SignatureHelper.calcSign("在高德开放平台申请的bizSecret", signArgs));
// 示例:{\"componentList\": [{\"componentId\": \"324677010013422503\",\"itemList\": [{\"itemId\": \"424677010013422503\",\"viewText\": \"测试修改\",\"optionList\": [{\"id\": \"176349772722668\",\"name\": \"单选1\"},{\"id\": \"176349772767741\",\"name\": \"单选2\",\"allowRemark\": 1}]}]}]}"
String componentUpdate = "自定义字段信息";
params.put("dimensionType", dimensionType);
params.put("componentUpdate", componentUpdate);
String response = MyHttpUtils.postFormUrlencoded(url, params);
System.out.println(response);
}
返回参数
3. 批量删除自定义字段
请求地址
特别注意:请求格式 from-data
请求参数
示例代码(以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 url = "https://restwia.amap.com/api/v1/wia/dimension/component/batch/delete";
Map<String, Object> params = new HashMap<>();
String workMapId = "工作地图id";
Integer dimensionType = 1;
params.put("key", "在高德开放平台申请的key");
params.put("openId", "当前操作用户的openId");
params.put("bizToken", "在高德开放平台申请的bizToken");
params.put("workMapId", workMapId);
String[] signArgs = new String[]{workMapId, String.valueOf(dimensionType)};
params.put("bizSign", SignatureHelper.calcSign("在高德开放平台申请的bizSecret", signArgs));
params.put("dimensionType", dimensionType);
//自定义字段列表是用逗号分割的字符串 示例:"324677010013434280, 324677010013460173"
params.put("componentList", "自定义字段列表");
String response = MyHttpUtils.postFormUrlencoded(url, params);
System.out.println(response);
}
返回参数
4. 分页查询自定义字段
请求地址
请求参数
示例代码(以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 url = "https://restwia.amap.com/api/v1/wia/dimension/component/page/query";
Map<String, Object> params = new HashMap<>();
String key = "在高德开放平台申请的key";
String openId = "当前操作用户的openId";
String workMapId ="要操作的工作地图id";
String bizToken = "在高德开放平台申请的bizToken";
String bizSecret = "在高德开放平台申请的bizSecret";
Integer dimensionType = 1;
params.put("key", key);
params.put("openId", openId);
params.put("workMapId", workMapId);
params.put("dimensionType", dimensionType);
params.put("pageNum", 1);
params.put("pageSize", 10);
params.put("bizToken", bizToken);
String[] signArgs = new String[]{workMapId,dimensionType.toString()};
params.put("bizSign", SignatureHelper.calcSign(bizSecret, signArgs));
url = MyHttpUtils.attachParamsToUrl(url, params);
String response = MyHttpUtils.postFormUrlencoded(url, null);
System.out.println(response);
}
返回参数
5、自定义字段指定id批量查询
请求地址
请求参数
示例代码(以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 url = "https://restwia.amap.com/api/v1/wia/dimension/component/listById";
Map<String, Object> params = new HashMap<>();
String workMapId = "工作地图id";
String openId = "高德开放用户id";
params.put("key", "在高德开放平台申请的key");
params.put("openId", "当前操作用户的openId");
params.put("bizToken", "在高德开放平台申请的bizToken");
params.put("workMapId", workMapId);
String[] signArgs = new String[]{workMapId, openId};
params.put("bizSign", SignatureHelper.calcSign("在高德开放平台申请的bizSecret", signArgs));
// 字段id 半角逗号分隔的字符串 示例:"424677010013422503,424677010013434278"
params.put("itemIds", "字段id");
String response = MyHttpUtils.postFormUrlencoded(url, params);
System.out.println(response);
}
返回参数
附表
6. 自定义字段分组新增
请求地址
请求参数
示例代码(以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 url = "https://restwia.amap.com/api/v1/wia/dimension/dimension/create";
Map<String, Object> params = new HashMap<>();
String workMapId = "工作地图id";
String openId = "高德开放用户id";
params.put("key", "在高德开放平台申请的key");
params.put("openId", "当前操作用户的openId");
params.put("bizToken", "在高德开放平台申请的bizToken");
params.put("workMapId", workMapId);
String[] signArgs = new String[]{workMapId, openId};
params.put("bizSign", SignatureHelper.calcSign("在高德开放平台申请的bizSecret", signArgs));
params.put("dimensionType", 1);
params.put("name", "自定义分组名称");
// 自定义字段的id 逗号分页的字符串 示例:"324677010013422503,324677010013434278"
params.put("componentIds", "自定义字段的id");
String response = MyHttpUtils.postFormUrlencoded(url, params);
System.out.println(response);
}
返回参数
附表
7. 自定义字段分组修改
请求地址
请求参数
示例代码(以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 url = "https://restwia.amap.com/api/v1/wia/dimension/dimension/modify";
Map<String, Object> params = new HashMap<>();
String workMapId = "工作地图id";
String openId = "高德开放用户id";
params.put("key", "在高德开放平台申请的key");
params.put("openId", "当前操作用户的openId");
params.put("bizToken", "在高德开放平台申请的bizToken");
params.put("workMapId", workMapId);
String[] signArgs = new String[]{workMapId, openId};
params.put("bizSign", SignatureHelper.calcSign("在高德开放平台申请的bizSecret", signArgs));
params.put("dimensionId", "自定义字段分组id");
params.put("name", "修改后的自定义分组名称");
// 自定义字段的id 逗号分页的字符串 示例:"324677010013422503,324677010013434278"
params.put("componentIds", "自定义字段的id");
String response = MyHttpUtils.postFormUrlencoded(url, params);
System.out.println(response);
}
返回参数
附表
8. 自定义字段分组删除
请求地址
请求参数
示例代码(以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 url = "https://restwia.amap.com/api/v1/wia/dimension/dimension/delete";
Map<String, Object> params = new HashMap<>();
String workMapId = "工作地图id";
String openId = "高德开放用户id";
params.put("key", "在高德开放平台申请的key");
params.put("openId", "当前操作用户的openId");
params.put("bizToken", "在高德开放平台申请的bizToken");
params.put("workMapId", workMapId);
String[] signArgs = new String[]{workMapId, openId};
params.put("bizSign", SignatureHelper.calcSign("在高德开放平台申请的bizSecret", signArgs));
params.put("dimensionId", "自定义字段分组id");
String response = MyHttpUtils.postFormUrlencoded(url, params);
System.out.println(response);
}
返回参数
附表
9. 指定id批量查询自定义字段分组
请求地址
请求参数
示例代码(以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 url = "https://restwia.amap.com/api/v1/wia/dimension/dimension/listById";
Map<String, Object> params = new HashMap<>();
String workMapId = "工作地图id";
String openId = "高德开放用户id";
params.put("key", "在高德开放平台申请的key");
params.put("openId", "当前操作用户的openId");
params.put("bizToken", "在高德开放平台申请的bizToken");
params.put("workMapId", workMapId);
String[] signArgs = new String[]{workMapId, openId};
params.put("bizSign", SignatureHelper.calcSign("在高德开放平台申请的bizSecret", signArgs));
// 自定义字段分组id 逗号分割的字符串 示例:"524677010005278082,524677010005282086"
params.put("dimensionIds", "自定义字段分组id");
String response = MyHttpUtils.postFormUrlencoded(url, params);
System.out.println(response);
}
返回参数
附表
10. 分页查询自定义字段分组
请求地址
请求参数
示例代码(以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 url = "https://restwia.amap.com/api/v1/wia/dimension/dimension/page/query";
Map<String, Object> params = new HashMap<>();
String key = "在高德开放平台申请的key";
String openId = "当前操作用户的openId";
String workMapId ="要操作的工作地图id";
String bizToken = "在高德开放平台申请的bizToken";
String bizSecret = "在高德开放平台申请的bizSecret";
params.put("key", key);
params.put("openId", openId);
params.put("workMapId", workMapId);
params.put("dimensionType", 1);
params.put("pageNumber", 1);
params.put("pageSize", 20);
params.put("bizToken", bizToken);
String[] signArgs = new String[]{workMapId,openId};
params.put("bizSign", SignatureHelper.calcSign(bizSecret, signArgs));
url = MyHttpUtils.attachParamsToUrl(url, params);
String response = MyHttpUtils.postFormUrlencoded(url, null);
System.out.println(response);
}
返回参数
附表
附表
附:自定义字段控件类型(componentType 取值)
附:新增自定义字段的功能类型(dimensionType 取值)