@maptec/cli 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +284 -0
- package/bin/maptec.js +2 -0
- package/dist/chunk-K574OFFK.js +122 -0
- package/dist/chunk-K574OFFK.js.map +1 -0
- package/dist/cli.js +899 -0
- package/dist/cli.js.map +1 -0
- package/dist/store-ZU7HLXCV.js +18 -0
- package/dist/store-ZU7HLXCV.js.map +1 -0
- package/package.json +47 -0
- package/skills/README.md +30 -0
- package/skills/jsapi-skills/README.md +60 -0
- package/skills/jsapi-skills/SKILL.md +145 -0
- package/skills/jsapi-skills/package.json +31 -0
- package/skills/jsapi-skills/references/controls.md +195 -0
- package/skills/jsapi-skills/references/events.md +222 -0
- package/skills/jsapi-skills/references/geocoding.md +184 -0
- package/skills/jsapi-skills/references/map-style.md +123 -0
- package/skills/jsapi-skills/references/map.md +154 -0
- package/skills/jsapi-skills/references/marker.md +136 -0
- package/skills/jsapi-skills/references/operate.md +138 -0
- package/skills/jsapi-skills/references/overlay.md +311 -0
- package/skills/jsapi-skills/references/place-search.md +411 -0
- package/skills/jsapi-skills/references/poi-categories.md +123 -0
- package/skills/jsapi-skills/references/popup.md +146 -0
- package/skills/jsapi-skills/references/re-geocoding.md +183 -0
- package/skills/jsapi-skills/references/routing.md +347 -0
- package/skills/jsapi-skills/references/track.md +240 -0
- package/skills/jsapi-skills/scripts/validate_jsapi_skill.py +160 -0
- package/skills/webapi-skills/README.md +73 -0
- package/skills/webapi-skills/SKILL.md +63 -0
- package/skills/webapi-skills/package.json +32 -0
- package/skills/webapi-skills/references/direction-api.md +175 -0
- package/skills/webapi-skills/references/geocoding.md +195 -0
- package/skills/webapi-skills/references/ip-location.md +87 -0
- package/skills/webapi-skills/references/matrix-api.md +149 -0
- package/skills/webapi-skills/references/nearby-search.md +223 -0
- package/skills/webapi-skills/references/places.md +239 -0
- package/skills/webapi-skills/references/quick-start-cn.md +219 -0
- package/skills/webapi-skills/references/reverse-geocoding.md +157 -0
- package/skills/webapi-skills/references/suggest.md +111 -0
- package/skills/webapi-skills/references/text-search.md +282 -0
- package/skills/webapi-skills/scripts/validate_webapi_skill.py +158 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# 路线规划
|
|
2
|
+
|
|
3
|
+
## 1. 接口概述
|
|
4
|
+
|
|
5
|
+
**路线规划** 是一项企业级 HTTP 服务,面向驾车等场景:接收一个或多个坐标点(及可选途经点),返回可导航的路线方案。
|
|
6
|
+
|
|
7
|
+
## 2. 接口定义
|
|
8
|
+
|
|
9
|
+
| 属性 | 定义 |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| HTTP 方法 | `POST` |
|
|
12
|
+
| Endpoint URL | `https://api.maptec.com/routes/v1/directions` |
|
|
13
|
+
| 认证方式 | HTTP Header:`Authorization: Bearer <YOUR_API_KEY>` |
|
|
14
|
+
| 请求体格式 | `application/json` |
|
|
15
|
+
| 响应体格式 | `application/json` |
|
|
16
|
+
|
|
17
|
+
## 3. 请求参数
|
|
18
|
+
|
|
19
|
+
### 3.1 顶级对象
|
|
20
|
+
|
|
21
|
+
| 参数 | 类型 | 必填 | 说明 |
|
|
22
|
+
| --- | --- | --- | --- |
|
|
23
|
+
| origin | `Location Object` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#DCFCE7;color:#166534;font-weight:600;">是</span> | 路线的起点。 |
|
|
24
|
+
| destination | `Location Object` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#DCFCE7;color:#166534;font-weight:600;">是</span> | 路线的终点。 |
|
|
25
|
+
| waypoints | `Location[](Array)` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#FEE2E2;color:#991B1B;font-weight:600;">否</span> | 途经点列表,按顺序访问。 |
|
|
26
|
+
| mode | `String` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#DCFCE7;color:#166534;font-weight:600;">是</span> | 交通模式。V1.0支持:<br>· **`driving`**(标准驾车,默认)。 |
|
|
27
|
+
| departureTime | `String` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#FEE2E2;color:#991B1B;font-weight:600;">否</span> | **ISO 8601** 格式的时间戳(如 `2025-10-31T10:00:00Z`)。 <br>• **提供此时间**:计算未来该时间的交通状况。<br>• **不提供此时间**:默认为 **now**,使用 **实时路况**。 |
|
|
28
|
+
| strategy | `String` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#FEE2E2;color:#991B1B;font-weight:600;">否</span> | 路线计算策略,默认 `fastest`。<br>• fastest: 时间最快路线(时间优先)。 <br>• shortest: 最短距离路线(距离优先)。<br>• balanced: 在时间和驾驶复杂度(如减少复杂转向)之间取得平衡。 |
|
|
29
|
+
| alternatives | `Boolean` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#FEE2E2;color:#991B1B;font-weight:600;">否</span> | 是否返回备选路线,默认 `false`。 |
|
|
30
|
+
| language | `String` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#FEE2E2;color:#991B1B;font-weight:600;">否</span> | 导航指令(TBT)返回的语言。默认 `en-GB`。示例:`pt-BR`、`es-AR`。<br>V1.0支持:`en-GB`,`zh-CN`。 |
|
|
31
|
+
| units | `String` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#FEE2E2;color:#991B1B;font-weight:600;">否</span> | 距离单位.metric(米/公里)或 imperial(英尺/英里),默认 :metric。 |
|
|
32
|
+
| avoid | `Avoid Object` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#FEE2E2;color:#991B1B;font-weight:600;">否</span> | **[B2B核心]**<br>需要规避的区域或类型。需规避的区域或类型。 |
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### 3.2 Location 对象
|
|
36
|
+
|
|
37
|
+
| 参数 | 类型 | 必填 | 说明 |
|
|
38
|
+
| --- | --- | --- | --- |
|
|
39
|
+
| location | `LatLng Object` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#DCFCE7;color:#166534;font-weight:600;">是</span>(或 `placeId` ) | 经纬度坐标。 |
|
|
40
|
+
| placeId | `String` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#FEE2E2;color:#991B1B;font-weight:600;">否</span>(或 `location` ) | 使用我们的地理编码或搜索接口获取的 `placeId`。 |
|
|
41
|
+
| bearing | `Integer` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#FEE2E2;color:#991B1B;font-weight:600;">否</span> | 车辆的行驶航向 **0–359**,用于更精准的出发匹配。 |
|
|
42
|
+
| radius | `Integer` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#FEE2E2;color:#991B1B;font-weight:600;">否</span> | 允许匹配的半径(米),用于纠正不精确的坐标。 |
|
|
43
|
+
|
|
44
|
+
#### LatLng 对象
|
|
45
|
+
|
|
46
|
+
| 字段 | 类型 | 说明 |
|
|
47
|
+
| --- | --- | --- |
|
|
48
|
+
| latitude | `Number` | 纬度值(以度为单位), 取值`[-90.0, +90.0]` |
|
|
49
|
+
| longitude | `Number` | 经度值(以度为单位),取值 `[-180.0, +180.0]` |
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
### 3.3 Avoid 对象
|
|
53
|
+
|
|
54
|
+
| 参数 | 类型 | 必填 | 说明 |
|
|
55
|
+
| --- | --- | --- | --- |
|
|
56
|
+
| criteria | `String[]` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#FEE2E2;color:#991B1B;font-weight:600;">否</span> | 规避的常规类型。示例:`["highways"]`。<br>V1.0支持: highways: 避高速 |
|
|
57
|
+
| polygons | `GeoJSON Object` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#FEE2E2;color:#991B1B;font-weight:600;">否</span> | 客户自定义的规避多边形区域(GeoJSON FeatureCollection)。 |
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
## 4. 返回值
|
|
61
|
+
|
|
62
|
+
### 4.1 顶级响应对象
|
|
63
|
+
|
|
64
|
+
| 参数 | 类型 | 说明 |
|
|
65
|
+
| --- | --- | --- |
|
|
66
|
+
| status | `String` | 响应状态吗:`“OK”`:成功且有结果\|`“ERROR”`:请求失败\|`“NO_ROUTE_FOUND”`:成功但无结果 |
|
|
67
|
+
| routes | `Route[](Array)` | 路线方案列表。<br>如果 alternatives=true 且存在备选,则包含多条。 |
|
|
68
|
+
| error | `Error Object` | 当 `"status"` 为 `"ERROR"` 时返回,含 `code`、`message`. |
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
### 4.2 Route 对象
|
|
72
|
+
|
|
73
|
+
| 参数 | 类型 | 说明 |
|
|
74
|
+
| --- | --- | --- |
|
|
75
|
+
| summary | `Summary Object` | 整条路线的概要信息。 |
|
|
76
|
+
| legs | `Leg[](Array)` | 路线分段的列表;一个 leg 代表两个途经点(或起终点)之间的一段。 |
|
|
77
|
+
| overviewPolyline | `String` | **(核心)** 整条路线的缩略图,使用Google Polyline 5编码。 |
|
|
78
|
+
| warnings | `String[]` | 导航的警告信息,示例: ["Route avoids high_crime_zones due to user request."]。 |
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
### 4.3 Summary 对象 (用于 Route 和 Leg)
|
|
82
|
+
|
|
83
|
+
| 参数 | 类型 | 说明 |
|
|
84
|
+
| --- | --- | --- |
|
|
85
|
+
| distanceMeters | `Integer` | 距离(米)。 |
|
|
86
|
+
| durationSeconds | `Integer` | 基础通行时间(秒),不考虑实时路况。 |
|
|
87
|
+
| trafficDurationSeconds | `Integer` | 基于 `departureTime` 的预测性通行时间(秒)。 |
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
### 4.4 Leg 对象 (路段)
|
|
91
|
+
|
|
92
|
+
| 参数 | 类型 | 说明 |
|
|
93
|
+
| --- | --- | --- |
|
|
94
|
+
| summary | `Summary Object` | 此路段的概要信息(距离、时间)。 |
|
|
95
|
+
| startAddress | `String` | 此路段起点的格式化地址。 |
|
|
96
|
+
| endAddress | `String` | 此路段终点的格式化地址。 |
|
|
97
|
+
| steps | `Step[]` | **(核心)** <br>Turn-by-Turn(TBT) 导航指令列表。 |
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
### 4.5 Step 对象 (TBT指令)
|
|
101
|
+
|
|
102
|
+
| 参数 | 类型 | 说明 |
|
|
103
|
+
| --- | --- | --- |
|
|
104
|
+
| instruction | `String` | **(核心)** <br>人类可读的TBT文本。示例:"Vire à direita na Av. Paulista."<br>“前方500米进入某某道路” |
|
|
105
|
+
| turnType | `String` | **(核心)** <br>TBT的类型,用于UI显示图标,如 `STRAIGHT`、`TURN_LEFT`、`KEEP_RIGHT`、`ENTER_ROUNDABOUT`。 |
|
|
106
|
+
| distanceMeters | `Integer` | 该步骤的距离(米)。 |
|
|
107
|
+
| durationSeconds | `Integer` | 该步骤的(动态)通行时间(秒)。 |
|
|
108
|
+
| startLocation | `LatLng Object` | 经纬度坐标。 |
|
|
109
|
+
| endLocation | `LatLng Object` | 经纬度坐标。 |
|
|
110
|
+
| polyline | `String` | 该步骤的 Polyline 编码。 |
|
|
111
|
+
| speedLimit | `Integer` | 该段最高限速(km/h)。前段可根据此数据做“您已超速”的闪烁提示。 |
|
|
112
|
+
| roadClass | `String` | 道路等级。例如 `motorway`、`primary`、`residential`。(前段可根据此渲染不同颜色的路) |
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
## 5. 示例
|
|
116
|
+
|
|
117
|
+
### 示例 1:简单驾车请求 (实时路况)
|
|
118
|
+
|
|
119
|
+
**Request:** POST /v1/directions?apiKey=...
|
|
120
|
+
|
|
121
|
+
JSON
|
|
122
|
+
|
|
123
|
+
```plain
|
|
124
|
+
{
|
|
125
|
+
"origin": { "location": { "latitude": -23.5505, "longitude": -46.6333 } }, // São Paulo
|
|
126
|
+
"destination": { "location": { "latitude": -23.5616, "longitude": -46.6562 } },
|
|
127
|
+
"mode": "driving",
|
|
128
|
+
"language": "pt-BR"
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### 示例 2:核心返回值
|
|
133
|
+
|
|
134
|
+
**Response:** HTTP 200 OK
|
|
135
|
+
|
|
136
|
+
JSON
|
|
137
|
+
|
|
138
|
+
```plain
|
|
139
|
+
{
|
|
140
|
+
"status": "OK",
|
|
141
|
+
"routes": [
|
|
142
|
+
{
|
|
143
|
+
"summary": {
|
|
144
|
+
"distanceMeters": 435100,
|
|
145
|
+
"durationSeconds": 19800,
|
|
146
|
+
"trafficDurationSeconds": 21600 // [AI结果] 考虑早高峰预测,耗时21600秒
|
|
147
|
+
},
|
|
148
|
+
"overviewPolyline": "_p~iF~ps|U_ulLnnqC_...",
|
|
149
|
+
"legs": [
|
|
150
|
+
{
|
|
151
|
+
"summary": { "distanceMeters": 435100, ... },
|
|
152
|
+
"startAddress": "Av. Pres. Vargas, Rio de Janeiro - RJ, Brazil",
|
|
153
|
+
"endAddress": "Av. Paulista, São Paulo - SP, Brazil",
|
|
154
|
+
"steps": [
|
|
155
|
+
{
|
|
156
|
+
"instruction": "Siga na Av. Pres. Vargas.",
|
|
157
|
+
"turnType": "STRAIGHT",
|
|
158
|
+
"distanceMeters": 500,
|
|
159
|
+
"durationSeconds": 60,
|
|
160
|
+
"startLocation": { "latitude": -22.9068, "longitude": -43.1729 },
|
|
161
|
+
"endLocation": { "latitude": -22.9070, "longitude": -43.1735 }
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"instruction": "Vire à direita na Av. Rio Branco.",
|
|
165
|
+
"turnType": "TURN_RIGHT",
|
|
166
|
+
...
|
|
167
|
+
}
|
|
168
|
+
// ... 更多 steps
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
|
+
}
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
```
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# 正向地理编码
|
|
2
|
+
|
|
3
|
+
**正向地理编码** 能够将人类可读的地址转换为经纬度坐标。
|
|
4
|
+
|
|
5
|
+
## 1. 接口定义
|
|
6
|
+
|
|
7
|
+
- 接口请求方式为GET,在 Header 中传递API密钥(优先),URL备选,既安全又易于调试。
|
|
8
|
+
|
|
9
|
+
- **请求头包含** :
|
|
10
|
+
|
|
11
|
+
| **Header** | **描述** |
|
|
12
|
+
| --- | --- |
|
|
13
|
+
| Authorization: YOUR_API_KEY | 用于请求服务的API密钥。 |
|
|
14
|
+
|
|
15
|
+
**请求:** GET /search/{versionNumber}/geocode
|
|
16
|
+
|
|
17
|
+
**接口串 (Endpoint):** https://api.maptec.com/search/v1/geocode?parameters
|
|
18
|
+
|
|
19
|
+
- `parameters` 代表的参数包括必填参数和可选参数。所有参数均使用字符(&)进行分隔
|
|
20
|
+
|
|
21
|
+
## 2. 请求参数
|
|
22
|
+
|
|
23
|
+
### 2.1 查询参数
|
|
24
|
+
|
|
25
|
+
| 参数 | 类型 | 必填 | 说明 |
|
|
26
|
+
| --- | --- | --- | --- |
|
|
27
|
+
| apiKey | `String` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#DCFCE7;color:#166534;font-weight:600;">是</span> | 用于请求服务的API密钥。 |
|
|
28
|
+
| address | `String` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#DCFCE7;color:#166534;font-weight:600;">是</span> | 地址字符串。<br>注意事项:<br>·components 已包含足够信息,则可选。但对于完整地址进行地理编码时,如果请求中包含建筑物名称和编号,则必填。<br>·建议提供符合相关国家/地区的邮政服务所使用的地址格式,避免使用其他地址元素,例如企业名称、单元号、房间号或楼层号。<br>·搜索文本应以 URL 编码的 UTF-8 字符串形式表示,且不得包含分号(无论是原始分号还是 URL 编码后的分号)。解码后的搜索文本最多只能包含 50 个单词和数字,单词和数字之间用空格和标点符号分隔,且总长度不得超过 256 个字符。<br>*示例:`address=1%20St%20andrews%20rd,%20Singapore(%20为空格的网址转义)`* |
|
|
29
|
+
| components | `String` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#FEE2E2;color:#991B1B;font-weight:600;">否</span> | 地址组成部分过滤器,限制服务仅返回特定区域的结果。<br>格式:`component:value\|component:value`。<br> **支持过滤的 components 包括:** <br>·country:国家/地区名称或[ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)国家代码(如GB)。<br>·postalCode:邮政编码 <br>**以下 components 可用于影响结果:** <br>·thoroughfare:匹配路线的全称或简称。<br>·administrativeArea:匹配所有行政区划级别(匹配region、subregion,在某些国家地区会有区别)。<br> **注意事项:** <br>1.如果请求包含重复的过滤条件,将被视为“AND”,而不是“OR”。<br>2.对于每个地址组成部分,可以在 address 参数中指定它,也可以在 components 过滤条件中指定它,但不能同时指定这两者。在两者中指定相同的值可能会导致空值。<br>*示例:*<br>*1. 组合使用,查询位于 SG 内的 Bayfront Avenue :*<br>*`address=Bayfront+Avenue&components=country:SG`*<br>*2. 不使用address参数,仅使用 components 发出有效查询,如位于 Singapore 的 Surrey 路:*<br>*`components=thoroughfare:surrey\|country:Singapore`* |
|
|
30
|
+
| locationBias | `Rectangle Object` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#FEE2E2;color:#991B1B;font-weight:600;">否</span> | 地理偏向:优先返回该参数设置的矩形范围中的结果。<br>矩形(Rectangle对象):用两个经纬度值定义边界区域的 southwest 和 northeast 角。<br>*该参数只会增加对矩形范围内结果的偏向,但不能保证所有或任何结果都包含在该矩形范围内。* |
|
|
31
|
+
| language | `String` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#FEE2E2;color:#991B1B;font-weight:600;">否</span> | 返回结果中可本地化文本的首选语言。取值为符合 IETF BCP 47 / RFC 5646 的语言标签,且必须在本平台支持的语言列表内。例如:`en`、`en-US`。 <br>大小写不敏感,推荐使用规范大小写。若指定语言不可用、部分字段无对应翻译,或该地区数据仅有本地语言名称,则返回本地语言或平台默认语言。 <br>默认值:`en`。 |
|
|
32
|
+
| region | `String` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#FEE2E2;color:#991B1B;font-weight:600;">否</span> | 国家/地区代码,设置返回偏向特定地区的结果。该参数不会将结果严格限制在指定国家/地区内。<br>取值为 ISO 3166-1 alpha-2 / CLDR two-letter region code,大小写不敏感,推荐使用大写形式。例如:`BR`、`SG`。 |
|
|
33
|
+
|
|
34
|
+
### 2.2 Rectangle 对象
|
|
35
|
+
|
|
36
|
+
| 字段 | 类型 | 描述 |
|
|
37
|
+
| --- | --- | --- |
|
|
38
|
+
| northeast | `LatLng Object` | 矩形框的东北角。 |
|
|
39
|
+
| southwest | `LatLng Object` | 矩形框的西南角。 |
|
|
40
|
+
|
|
41
|
+
### 2.3 LatLng 对象
|
|
42
|
+
|
|
43
|
+
| 字段 | 类型 | 描述 |
|
|
44
|
+
| --- | --- | --- |
|
|
45
|
+
| latitude | `Number` | 纬度值(以度为单位),取值 `[-90.0, +90.0]` |
|
|
46
|
+
| longitude | `Number` | 经度值(以度为单位),取值 `[-180.0, +180.0]` |
|
|
47
|
+
|
|
48
|
+
## 3. 标准返回值
|
|
49
|
+
|
|
50
|
+
### 3.1 顶级响应对象
|
|
51
|
+
|
|
52
|
+
| 字段 | 类型 | 描述 |
|
|
53
|
+
| --- | --- | --- |
|
|
54
|
+
| status | `String` | 响应请求的状态码。可能包含以下值:<br>`"OK"` 表示请求成功,并且至少返回了一条结果。<br>`"ZERO_RESULTS"` 表示请求成功,但未返回任何结果。<br>`"ERROR"` 表示请求失败。 |
|
|
55
|
+
| results | `GeoResult[]` | 以 JSON 对象的形式返回响应。当服务返回结果时,会将结果放置在 results 数组中。即使未返回任何结果(例如,地址不存在),仍会返回一个空的 results 数组。 |
|
|
56
|
+
| error | `Error Object` | 当 `"status"` 为 `"ERROR"` 时返回,包含 `code`、`message`。 |
|
|
57
|
+
|
|
58
|
+
### 3.2 GeoResult 对象
|
|
59
|
+
|
|
60
|
+
| 字段 | 类型 | 描述 |
|
|
61
|
+
| --- | --- | --- |
|
|
62
|
+
| placeId | `String` | 地点的唯一标识符,可与其他服务搭配使用。 |
|
|
63
|
+
| formattedAddress | `String` | 该位置格式化后完整地址。 |
|
|
64
|
+
| types | `String[]` | 返回结果的实体类型,用于标识结果中所返回的地图项的类型。*详细类型见[《地址类型和地址组成部分》](#5.-地址类型与组成部分)*。 |
|
|
65
|
+
| languageCode | `String` | 符合 IETF BCP 47 / RFC 5646 的语言标签。如 `en-US`。 |
|
|
66
|
+
| addressComponents | `AddressComponent[]` | 结构化地址组件数组,包含适用于该地址的各个组成部分。 |
|
|
67
|
+
| geometry | `Geometry Object` | 返回要素空间几何形状与坐标置信度评价。 |
|
|
68
|
+
| matchDetails | `Object` | 匹配质量评价。|
|
|
69
|
+
| supplementaryInfo | `Object` | 附加元数据与辅助描述。 |
|
|
70
|
+
|
|
71
|
+
### 3.3 AddressComponent 对象
|
|
72
|
+
|
|
73
|
+
| 字段 | 类型 | 描述 |
|
|
74
|
+
| --- | --- | --- |
|
|
75
|
+
| type | `String` | 表示地址组成部分的通用类型。 |
|
|
76
|
+
| localType | `String` | 当地称呼。 |
|
|
77
|
+
| longName | `String` | 地址组成部分的完整文本说明或名称。 |
|
|
78
|
+
| shortName | `String` | 地址组成部分的缩写文本名称(如有)。 |
|
|
79
|
+
| isoCode | `String` | 仅 `type` 为 `country`、`region` 时返回:ISO 3166 唯一代码。 |
|
|
80
|
+
|
|
81
|
+
### 3.4 Geometry 对象
|
|
82
|
+
|
|
83
|
+
| 字段 | 类型 | 描述 |
|
|
84
|
+
| --- | --- | --- |
|
|
85
|
+
| location | `LatLng Object` | 纬度/经度对应的对象。 |
|
|
86
|
+
| locationType | `String` | 位置匹配精度类型。目前支持以下值:<br>·“ROOFTOP” 表示返回的结果是一个精确到街道地址级别的地理编码。<br>·“INTERPOLATED” 表示返回的结果为插值结果。当无法精确匹配时,通常会返回插值到两个精确点之间的位置(通常是在道路上)。<br>·“CENTER” 表示返回的结果是多段线(例如街道)或多边形(区域)等结果的几何图形中心。 |
|
|
87
|
+
| viewport | `Viewport Object` | 返回结果的推荐视口,通过 northeast 和 southwest 定义的矩形范围。 |
|
|
88
|
+
|
|
89
|
+
### 3.5 Viewport 对象
|
|
90
|
+
|
|
91
|
+
| 字段 | 类型 | 描述 |
|
|
92
|
+
| --- | --- | --- |
|
|
93
|
+
| northeast | `LatLng Object` | 推荐视口的矩形区域东北角。 |
|
|
94
|
+
| southwest | `LatLng Object` | 推荐视口的矩形区域西南角。 |
|
|
95
|
+
|
|
96
|
+
### 3.6 matchDetails 对象
|
|
97
|
+
|
|
98
|
+
| 字段 | 类型 | 描述 |
|
|
99
|
+
| --- | --- | --- |
|
|
100
|
+
| matchScore | `Double` | 综合匹配得分 **(0.00 - 1.00)**。 |
|
|
101
|
+
| matchLevel | `String` | 最终匹配到的最高层级。 |
|
|
102
|
+
| isDegraded | `Boolean` | 是否发生回退(如输入门牌但仅匹配到道路)。 |
|
|
103
|
+
| isPartial | `Boolean` | 是否仅进行部分匹配,表示服务无法返回与原始请求完全匹配的结果。<br>最常见原因:<br>·请求中所传递的市行政区内不存在相关街道地址。<br>·当请求与同一市行政区中的两个或更多位置相匹配时,也可能会返回部分匹配。<br>·如果请求中包含拼写错误的地址组成部分,地理编码服务可能会推荐备选地址。通过这种方式触发的建议也将标记为部分匹配。 |
|
|
104
|
+
| fieldScores | `fieldScores Object` | 各层级匹配得分,包含匹配到的层级及得分。(用于分析诊断) |
|
|
105
|
+
|
|
106
|
+
### 3.7 supplementaryInfo 对象
|
|
107
|
+
|
|
108
|
+
| 字段 | 类型 | 描述 |
|
|
109
|
+
| --- | --- | --- |
|
|
110
|
+
| externalId | `String` | 本地官方编码(如阿联酋 Makani码)。 |
|
|
111
|
+
| relativeLocation | `String` | 相对位置描述(地址上下文)。 |
|
|
112
|
+
|
|
113
|
+
## 4. JSON 示例
|
|
114
|
+
|
|
115
|
+
```json
|
|
116
|
+
{
|
|
117
|
+
"status": "OK",
|
|
118
|
+
"results": [
|
|
119
|
+
{
|
|
120
|
+
"placeId": "ChIJRxcAvRO7j4AR6hm6tys8yA8",
|
|
121
|
+
"formattedAddress": "Unit 201, Marina Heights, Dubai Marina, Dubai, AE",
|
|
122
|
+
"types": ["premise"],
|
|
123
|
+
"languageCode": "en-US",
|
|
124
|
+
"addressComponents": [
|
|
125
|
+
{
|
|
126
|
+
"type": "country",
|
|
127
|
+
"longName": "United Arab Emirates",
|
|
128
|
+
"shortName": "AE",
|
|
129
|
+
"isoCode": "AE"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"type": "region",
|
|
133
|
+
"localType": "Emirate",
|
|
134
|
+
"longName": "Dubai",
|
|
135
|
+
"isoCode": "AE-DU"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"type": "premise",
|
|
139
|
+
"longName": "Marina Heights"
|
|
140
|
+
}
|
|
141
|
+
],
|
|
142
|
+
"geometry": {
|
|
143
|
+
"location": {
|
|
144
|
+
"lat": 25.08,
|
|
145
|
+
"lng": 55.14
|
|
146
|
+
},
|
|
147
|
+
"locationType": "ROOFTOP",
|
|
148
|
+
"viewport": {
|
|
149
|
+
"northeast": {
|
|
150
|
+
"latitude": 40.780785,
|
|
151
|
+
"longitude": -73.961895
|
|
152
|
+
},
|
|
153
|
+
"southwest": {
|
|
154
|
+
"latitude": 40.778088,
|
|
155
|
+
"longitude": -73.964593
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
"matchDetails": {
|
|
160
|
+
"matchScore": 0.98,
|
|
161
|
+
"matchLevel": "premise",
|
|
162
|
+
"isDegraded": false,
|
|
163
|
+
"isPartial": false,
|
|
164
|
+
"fieldScores": {
|
|
165
|
+
"country": 1.0,
|
|
166
|
+
"region": 1.0,
|
|
167
|
+
"sublocality": 1.0,
|
|
168
|
+
"premise": 0.98,
|
|
169
|
+
"subpremise": 0.97
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
"supplementaryInfo": {
|
|
173
|
+
"externalId": "1234567890",
|
|
174
|
+
"relativeLocation": "Next to the Marina Pharmacy"
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## 5. 地址类型与组成部分
|
|
182
|
+
|
|
183
|
+
| 地址类型 | 说明 |
|
|
184
|
+
| --- | --- |
|
|
185
|
+
| `country` | 表示国家政治实体(ISO 3166-1 alpha-2) |
|
|
186
|
+
| `region` | 一级行政区(ISO 3166-2,省/州/自治区/酋长国等) |
|
|
187
|
+
| `subregion` | 二级行政区(地级市/郡/县),在部分国家不常用 |
|
|
188
|
+
| `locality` | 城镇/核心城市,用户常用的行政定位 |
|
|
189
|
+
| `sublocality` | 区/街道/社区,对于在人口密集的亚洲/拉美是非常关键的 |
|
|
190
|
+
| `neighborhood` | 最小地块单元(小区/村/住宅区) |
|
|
191
|
+
| `thoroughfare` | 道路名称 |
|
|
192
|
+
| `premise` | 门牌号、楼栋号 |
|
|
193
|
+
| `subpremise` | 单元/楼层/房间号(通常由用户手动输入) |
|
|
194
|
+
| `postalCode` | 表示国家/地区内邮寄地址所用的邮政编码 |
|
|
195
|
+
| `intersection` | 主要交叉路口,通常是两条主要道路的交叉路口 |
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: IP 定位服务(IP Location)
|
|
3
|
+
source: https://www.yuque.com/zhishitairenxing/qp9bda/qg5hfpkpl2lvonwo/markdown?plain=true
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# IP 定位服务(IP Location)
|
|
7
|
+
|
|
8
|
+
## 1. 接口设计定义
|
|
9
|
+
|
|
10
|
+
- **请求协议:** HTTP POST (Content-Type: application/json)
|
|
11
|
+
- **请求地址:** [https://test-api.maptec.com/location/v1/ip](https://test-api.maptec.com/location/v1/ip)
|
|
12
|
+
- **鉴权方式:** Header `Authorization: YOUR_API_KEY`
|
|
13
|
+
|
|
14
|
+
## 2. 接口参数定义 (Request)
|
|
15
|
+
|
|
16
|
+
| 参数名 | 类型 | 必填 | 描述 |
|
|
17
|
+
| --- | --- | --- | --- |
|
|
18
|
+
| ip | String | 是 | 待查询的 IPv4 或 IPv6 地址,如 `"114.114.114.114"`。 |
|
|
19
|
+
| output | String | 否 | 返回格式,默认 `json`。 |
|
|
20
|
+
|
|
21
|
+
### 请求示例
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"ip": "223.5.5.5"
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 3. 返回值定义 (Response)
|
|
30
|
+
|
|
31
|
+
返回结构需包含业务状态码与地理信息实体。
|
|
32
|
+
|
|
33
|
+
| 字段名 | 类型 | 说明 |
|
|
34
|
+
| --- | --- | --- |
|
|
35
|
+
| status | String | 响应请求的状态码。`"OK"` 表示请求成功并至少返回一条结果;`"ZERO_RESULTS"` 表示请求成功但未返回结果;`"ERROR"` 表示请求失败。 |
|
|
36
|
+
| message | String | 状态说明。 |
|
|
37
|
+
| result | Object | 结果实体。 |
|
|
38
|
+
| result.country | String | 国家名称。 |
|
|
39
|
+
| result.countryCode | String | 国家简码,ISO 3166-1 alpha-2,如 `US`。 |
|
|
40
|
+
| result.province | String | 一级行政区名称,如省、州、直辖市等。 |
|
|
41
|
+
| result.provinceCode | String | 一级行政区简码,ISO 3166-2,如 `CA`。 |
|
|
42
|
+
| result.city | String | 城市名称。 |
|
|
43
|
+
| result.location | Object | 地理位置对象。 |
|
|
44
|
+
| result.location.lat | Double | 纬度。 |
|
|
45
|
+
| result.location.lng | Double | 经度。 |
|
|
46
|
+
| error | Error Object | 当 `status` 为 `"ERROR"` 或 `"ZERO_RESULTS"` 时返回,包含 `code` 和 `message`。 |
|
|
47
|
+
|
|
48
|
+
### 正常返回示例
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"status": "OK",
|
|
53
|
+
"result": {
|
|
54
|
+
"country": "United States",
|
|
55
|
+
"countryCode": "US",
|
|
56
|
+
"province": "California",
|
|
57
|
+
"provinceCode": "CA",
|
|
58
|
+
"city": "San Francisco",
|
|
59
|
+
"location": {
|
|
60
|
+
"lat": 37.7749,
|
|
61
|
+
"lng": -122.4194
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 空值返回示例
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"status": "ZERO_RESULTS",
|
|
72
|
+
"message": "NOT_FOUND_IP",
|
|
73
|
+
"error": null
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### 错误返回示例
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"status": "ERROR",
|
|
82
|
+
"error": {
|
|
83
|
+
"code": "21400",
|
|
84
|
+
"message": "INVALID_REQUEST_IP"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# 距离矩阵
|
|
2
|
+
|
|
3
|
+
**距离矩阵** 是一项全球兼容的企业级 HTTP 服务,提供从多个起点到多个终点的行程距离与时间批量计算能力。服务支持 **1×N** (单起点多终点)与 **M×N** (多起点多终点)两种矩阵模式,面向同城配送、网约车调度、长途货运规划等多样化业务需求。
|
|
4
|
+
|
|
5
|
+
## 1. 接口定义
|
|
6
|
+
|
|
7
|
+
| 属性 | 定义 |
|
|
8
|
+
| :--- | :--- |
|
|
9
|
+
| HTTP 方法 | `POST` |
|
|
10
|
+
| Endpoint URL | `https://api.maptec.com/matrix/v1/distance` |
|
|
11
|
+
| 认证方式 | HTTP Header:`Authorization: Bearer <YOUR_API_KEY>` |
|
|
12
|
+
| 请求体格式 | `application/json` |
|
|
13
|
+
| 响应体格式 | `application/json` |
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### 矩阵模式支持:
|
|
17
|
+
|
|
18
|
+
| 模式 | 描述 | 典型场景 |
|
|
19
|
+
| :--- | :--- | :--- |
|
|
20
|
+
| **1×N** | 一个起点 → 多个终点 | 门店配送、就近查询 |
|
|
21
|
+
| **M×N** | 多个起点 → 多个终点 | 路由优化、物流调度 |
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## 2. 请求参数
|
|
25
|
+
|
|
26
|
+
### 2.1 顶级对象
|
|
27
|
+
|
|
28
|
+
| 参数 | 类型 | 必填 | 说明 |
|
|
29
|
+
| :--- | :--- | :--- | :--- |
|
|
30
|
+
| origins | `Location[](Array)` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#DCFCE7;color:#166534;font-weight:600;">是</span> | 起点数组。格式:`[{"lat": 39.9, "lng": 116.4}, ...]` 。<br>`origins` 数量 × `destinations` 数量 ≤ **25 × 25** 个元素。 |
|
|
31
|
+
| destinations | `Location[](Array)` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#DCFCE7;color:#166534;font-weight:600;">是</span> | 终点数组。格式:`[{"lat": 39.9, "lng": 116.4}, ...]` 。 |
|
|
32
|
+
| mode | `String` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#FEE2E2;color:#991B1B;font-weight:600;">否</span> | 交通模式,默认 `driving` 。 |
|
|
33
|
+
| trafficEnabled | `boolean` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#FEE2E2;color:#991B1B;font-weight:600;">否</span> | 是否启用实时路况,默认为 `false` 。 |
|
|
34
|
+
| departureTime | `String` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#FEE2E2;color:#991B1B;font-weight:600;">否</span> | 出发时间,**ISO 8601** 格式(如 `2025-10-31T10:00:00Z`)。 <br>· **提供此时间:** 预测性 ETA,按该时刻预测路况。<br>· **不提供此时间:** 视为 now,使用实时路况。 |
|
|
35
|
+
| strategy | `String` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#FEE2E2;color:#991B1B;font-weight:600;">否</span> | 路线策略,默认 `default` 。可选值:`fastest` (最快)、`shortest` (最短)等。 |
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### 2.2 Location 对象(起终点坐标)
|
|
39
|
+
|
|
40
|
+
| 字段 | 类型 | 必填 | 说明 |
|
|
41
|
+
| :--- | :--- | :--- | :--- |
|
|
42
|
+
| lat | `Number` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#DCFCE7;color:#166534;font-weight:600;">是</span> | 纬度值(WGS-84),取值 `[-90.0, +90.0]` |
|
|
43
|
+
| lon | `Number` | <span style="display:inline-block;padding:2px 10px;border-radius:999px;background:#DCFCE7;color:#166534;font-weight:600;">是</span> | 经度值(WGS-84),取值 `[-180.0, +180.0]` |
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
## 3. 返回值
|
|
47
|
+
|
|
48
|
+
### 3.1 同步模式响应(HTTP 200)
|
|
49
|
+
|
|
50
|
+
| 参数 | 类型 | 说明 |
|
|
51
|
+
| :--- | :--- | :--- |
|
|
52
|
+
| code | `String` | 业务状态码,`0` 表示成功,`-1` 表示失败 |
|
|
53
|
+
| message | `String` | 响应说明,`OK` 表示成功 |
|
|
54
|
+
| data | `Object` | 矩阵计算结果对象 |
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
### 3.2 data 对象
|
|
58
|
+
|
|
59
|
+
| 参数 | 类型 | 说明 |
|
|
60
|
+
| :--- | :--- | :--- |
|
|
61
|
+
| routes | `RouteResult[](Array)` | 路线结果列表,按 `sources × destinations` 展开 |
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
### 3.3 RouteResult 对象
|
|
65
|
+
|
|
66
|
+
| 参数 | 类型 | 说明 |
|
|
67
|
+
| :--- | :--- | :--- |
|
|
68
|
+
| status | `String` | 单条路线状态:`OK` / `FAILED` / `NO_ROUTE` |
|
|
69
|
+
| diatance | `number` | 路线距离,单位:米(m)。`status != OK` 时为 `-1` |
|
|
70
|
+
| duration | `number` | 路线时间,单位:秒(s)。`status != OK` 时为 `-1` |
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
## 4. 示例
|
|
74
|
+
|
|
75
|
+
### 4.1 请求(2 起点 × 2 终点)
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"origins": [
|
|
80
|
+
{ "lon": 116.397428, "lat": 39.90923 },
|
|
81
|
+
{ "lon": 116.3221, "lat": 39.9033 }
|
|
82
|
+
],
|
|
83
|
+
"destinations": [
|
|
84
|
+
{ "lon": 116.4378, "lat": 39.9234 },
|
|
85
|
+
{ "lon": 116.4074, "lat": 39.9042 }
|
|
86
|
+
],
|
|
87
|
+
"mode": "driving",
|
|
88
|
+
"departure_time": "2025-10-31T09:00:00Z",
|
|
89
|
+
"strategy": "fastest"
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### 4.2 返回值
|
|
94
|
+
|
|
95
|
+
*Response: HTTP 200 OK*
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"code": "OK",
|
|
100
|
+
"message": "success",
|
|
101
|
+
"data": {
|
|
102
|
+
"routes": [
|
|
103
|
+
{ "status": "OK", "distance": 8.5, "duration": 2 },
|
|
104
|
+
{ "status": "OK", "distance": 6.2, "duration": 8 },
|
|
105
|
+
{ "status": "NO_ROUTE", "distance": -1, "duration": -1 },
|
|
106
|
+
{ "status": "FAILED", "distance": -1, "duration": -1 }
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
> **结果顺序说明:** `routes` 数组按 `origins × destinations` 顺序展开,即 `routes[i * len(destinations) + j]` 对应 `origins[i]` → `destinations[j]` 的路线结果。
|
|
113
|
+
|
|
114
|
+
## 6. 错误与状态
|
|
115
|
+
|
|
116
|
+
### 6.1 HTTP 状态码
|
|
117
|
+
|
|
118
|
+
| HTTP Code | 说明 |
|
|
119
|
+
|---|---|
|
|
120
|
+
| `200` | 同步请求成功(业务结果见 `code` 字段) |
|
|
121
|
+
| `202` | 异步任务已接受(仅异步接口) |
|
|
122
|
+
| `400` | 请求参数错误 |
|
|
123
|
+
| `401` | 认证失败,Token 无效或已过期 |
|
|
124
|
+
| `403` | 权限不足 |
|
|
125
|
+
| `429` | 请求过于频繁,触发限流 |
|
|
126
|
+
| `500` | 服务端内部错误 |
|
|
127
|
+
| `503` | 服务暂不可用(如引擎加载中) |
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
### 6.2 单条路线状态码(status 字段)
|
|
131
|
+
|
|
132
|
+
| 状态码 | 含义 | 说明 |
|
|
133
|
+
|---|---|---|
|
|
134
|
+
| `OK` | 成功 | 路线计算成功 |
|
|
135
|
+
| `FAILED` | 失败 | 路线计算失败 |
|
|
136
|
+
| `NO_ROUTE` | 无路线 | 起终点间不存在可用路线 |
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
## 7. 约束与限制
|
|
140
|
+
|
|
141
|
+
| 限制项 | 规则 | 超限处理方式 |
|
|
142
|
+
|---|---|---|
|
|
143
|
+
| 起点数量(同步) | ≤ 25 | 返回 `400`,错误信息:`sources count exceeds limit of 25` |
|
|
144
|
+
| 终点数量(同步) | ≤ 25 | 返回 `400`,错误信息:`destinations count exceeds limit of 25` |
|
|
145
|
+
| 路线总数(同步) | ≤ 625(25×25) | 由起点和终点数量乘积决定,超限返回 `400` |
|
|
146
|
+
| 起终点最大距离 | ≤ 400 km | 单条路线超限返回 `status: FAILED`,`status_code: 3003` |
|
|
147
|
+
| 实时路况路线数 | ≤ 100 | 启用 `traffic_enabled=true` 时,路线总数不得超过 100 |
|
|
148
|
+
| 坐标系 | WGS-84 | 非 WGS-84 坐标可能导致吸附偏差 |
|
|
149
|
+
| 坐标精度 | 建议保留 6 位小数 | 约 0.1 米精度 |
|