Skip to content
On this page

要素 API

地理要素管理相关的 API 接口。

获取要素列表

GET /api/features

查询参数

参数类型说明
projectIdstring项目ID
layerIdstring图层ID
bboxstring边界框,格式: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

请求参数

参数类型必填说明
projectIdstring项目ID
layerIdstring图层ID
typestring要素类型:Point/LineString/Polygon
coordinatesarray坐标
propertiesobject属性

请求示例

json
{
  "projectId": "uuid",
  "layerId": "uuid",
  "type": "Point",
  "coordinates": [116.4074, 39.9042],
  "properties": {
    "name": "新地点"
  }
}

更新要素

PUT /api/features/{id}

请求参数

参数类型必填说明
coordinatesarray坐标
propertiesobject属性

删除要素

DELETE /api/features/{id}

批量导入

POST /api/features/import

请求参数

参数类型必填说明
projectIdstring项目ID
fileFileGeoJSON/Shapefile

空间查询

POST /api/features/query

请求参数

参数类型必填说明
projectIdstring项目ID
geometryobject查询几何
relationstring关系:intersect/within/distance

基于 MIT 许可发布