要素 API
地理要素管理相关的 API 接口。
获取要素列表
GET /api/features
查询参数
| 参数 | 类型 | 说明 |
|---|---|---|
| projectId | string | 项目ID |
| layerId | string | 图层ID |
| bbox | string | 边界框,格式:minX,minY,maxX,maxY |
响应示例
json
{
"success": true,
"data": {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"id": "uuid",
"geometry": {
"type": "Point",
"coordinates": [116.4074, 39.9042]
},
"properties": {
"name": "北京",
"population": 21540000
}
}
]
}
}
创建要素
POST /api/features
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| projectId | string | 是 | 项目ID |
| layerId | string | 是 | 图层ID |
| type | string | 是 | 要素类型:Point/LineString/Polygon |
| coordinates | array | 是 | 坐标 |
| properties | object | 否 | 属性 |
请求示例
json
{
"projectId": "uuid",
"layerId": "uuid",
"type": "Point",
"coordinates": [116.4074, 39.9042],
"properties": {
"name": "新地点"
}
}
更新要素
PUT /api/features/{id}
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| coordinates | array | 否 | 坐标 |
| properties | object | 否 | 属性 |
删除要素
DELETE /api/features/{id}
批量导入
POST /api/features/import
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| projectId | string | 是 | 项目ID |
| file | File | 是 | GeoJSON/Shapefile |
空间查询
POST /api/features/query
请求参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| projectId | string | 是 | 项目ID |
| geometry | object | 是 | 查询几何 |
| relation | string | 否 | 关系:intersect/within/distance |