Files
AssetsMap/assetsMap/boundary-doc.md
2026-06-18 16:26:31 +08:00

150 lines
3.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 资产边界数据配置说明
## 数据格式
边界数据存储在表单字段 **"资产边界数据"** 中,格式为 JSON 字符串。
## 整体结构
```json
{
"regions": [ 1, 2, ... ],
"color": "#ff0000"
}
```
| 字段 | 类型 | 说明 |
|------|------|------|
| `regions` | 数组 | 区域列表,每个区域是一个独立的外圈(可带孔洞) |
| `color` | 字符串 | 边界颜色,十六进制色值,如 `#ff0000`(红色)、`#3498db`(蓝色) |
## 单个区域结构
```json
{
"id": 1780905134732976,
"outer": [ 1, 2, ... ],
"holes": [ 1, 2, ... ]
}
```
| 字段 | 类型 | 说明 |
|------|------|------|
| `id` | 数字 | 区域唯一标识(系统自动生成的随机整数),手动配置时可随意填一个不重复的数字 |
| `outer` | 数组 | 外圈边界坐标,至少 3 个点 |
| `holes` | 数组 | 孔洞列表,每个孔洞也是一个坐标数组(至少 3 个点),可为空数组 `[]` |
## 坐标格式
每个坐标点为 **`[纬度, 经度]`**,注意顺序是 **纬度在前,经度在后**
示例:`[30.68239, 111.31176]`
## 配置示例
### 1. 单个简单区域(无孔洞)
```json
{
"regions": [
{
"id": 100001,
"outer": [
[30.68, 111.31],
[30.69, 111.38],
[30.74, 111.38],
[30.74, 111.34],
[30.74, 111.30],
[30.71, 111.28]
],
"holes": []
}
],
"color": "#ff0000"
}
```
### 2. 单个区域带一个孔洞
```json
{
"regions": [
{
"id": 100002,
"outer": [
[30.68, 111.31],
[30.69, 111.38],
[30.74, 111.38],
[30.74, 111.30],
[30.71, 111.28]
],
"holes": [
[
[30.70, 111.33],
[30.72, 111.37],
[30.73, 111.35],
[30.72, 111.32]
]
]
}
],
"color": "#ff0000"
}
```
### 3. 多个独立区域
```json
{
"regions": [
{
"id": 100003,
"outer": [
[30.68, 111.31],
[30.69, 111.38],
[30.74, 111.38],
[30.71, 111.28]
],
"holes": []
},
{
"id": 100004,
"outer": [
[30.68, 111.43],
[30.67, 111.50],
[30.74, 111.52],
[30.75, 111.44],
[30.71, 111.39]
],
"holes": [
[
[30.69, 111.45],
[30.72, 111.50],
[30.74, 111.48],
[30.72, 111.41]
]
]
}
],
"color": "#ff0000"
}
```
## 注意事项
1. **坐标顺序**:必须是 `[纬度, 经度]`,即 `[lat, lng]`
2. **最少点数**:每个外圈和孔洞至少需要 **3 个坐标点**
3. **孔洞范围**:孔洞必须完全位于其所属外圈内部
4. **区域 ID**`id` 为任意不重复的数字,建议使用时间戳+随机数
5. **颜色值**:支持标准十六进制格式,如 `#ff0000``#3498db``#27ae60`
6. **多区域共用一个颜色**:所有区域使用同一个 `color`
7. **字段名称**:存储在表单字段 **"资产边界数据"** 中
## 坐标获取方式
推荐使用坐标拾取工具获取经纬度:
- **高德坐标拾取器**https://lbs.amap.com/tools/picker
- **百度坐标拾取器**https://api.map.baidu.com/lbsapi/getpoint/index.html
在地图上依次点击区域顶点,复制坐标填入即可。