feature


URI

  1. <features_uri>/{featureID}[.<format>]
  2. /feature/{datasourceIndex}-{datasetIndex}-{featureIndex}[.<format>]

支持的方法

GETPUTDELETEHEAD

父资源

features

子资源

attachmentsmetadata

介绍

feature 资源表示一个要素。通过 feature 资源可以完成对要素信息的获取,修改和删除(当要素类型为点、线、面、文本、复合数据集或纯属性表数据集时才能修改和删除)。

feature 资源可以通过要素的 ID 号({featureId}) 来获取(URI1),也可以通过要素的索引号来获取(URI2)。

注意:URI2 是一种简化的访问 feature 的 URI,直接在最后把数据源、数据集、要素的索引用“-”连接,快速地确定一个要素。在示意 URI 中,{datasourceIndex}表示数据源索引,{datasetIndex}表示数据集索引,{featureIndex}表示要素索引。例如:http://supermapiserver:8090/iserver/services/data-world/rest/data/feature/0-2-7,就表示索引为0的数据源中,索引为2的数据集下,索引为7的要素,该 URI 同样有 rjson、json、html、xml、kml 五种表述格式。

支持的方法:

支持的表述格式:RJSON、JSON、HTML、XML、KML、GeoRSS、GeoJSON。

注:当要素类型为点、线、面时,GeoJSON表述可用。

资源层次

根资源 data datasources.htm datasource.htm datasets.htm features.htm feature 资源 dataset.htm

HTTP 请求方法

对如下 URI 执行 HTTP 请求,以 rjson 输出格式为例加以说明,其中,supermapiserver 是服务器名。

http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/Countries/features/featureid.rjson

GET 请求

获取一个要素的信息,包括属性字段名称列表、属性字段值列表,以及要素对应的几何对象。

请求参数

对 feature 资源执行 GET 请求,获取要素的信息,可以在 URI 中包含如下参数:

名称 类型 含义
hasGeometry boolean 是否获取几何对象的信息,true 表示获取在表述中包含几何对象的信息,false 表示不包含几何对象的信息。默认为 true。

当不传参数时,默认地,对 feature 资源执行 GET 请求,得到的表述中会包含几何对象的信息。

响应结构

对 feature 资源执行 GET 请求,返回的资源表述的结构如下(资源表述在响应消息的实体主体里):

名称 类型 含义
ID int 要素的 ID。
fieldNames String[] 要素的属性字段名集合。
fieldValues String[] 要素的属性字段值集合。
stringID String 要素ID 。
geometry Geometry 要素对应的几何对象。 具体包括几何对象的类型、几何对象的样式信息、组成要素的几何点的坐标等。

注:视频数据集中的 feature 资源执行 GET 请求,返回的资源表述的结构如下(资源表述在响应消息的实体主体里):

名称 类型 含义
ID int 要素的 ID。
fieldNames String[] 要素的属性字段名集合。
fieldValues String[] 要素的属性字段值集合。
stringID String 要素ID 。
address Sting 视频流的获取地址。
videoParameters videoParameters 相机参数。
name Sting 视频名称。
startTime Sting 视频开始时间。
cameraLocation cameraLocation 相机外参。包括拍摄视频的摄像头的x、y、z坐标及侧偏角、俯仰角和偏航角等值。
endTime String 视频结束时间。
geometry Geometry 当前视频参数对应的的视频视角空间范围。 具体包括几何对象类型(只支持矩形 REGION)、几何对象的样式信息、组成要素的几何点的坐标、中心点坐标等。

示例1

对示例 feature 资源执行 GET 请求,以 URI1 为例,不返回几何对象的信息,构建 URI 如下:

http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/Countries/features/247.rjson?hasGeometry=false

则返回 ID 为247的要素的资源表述如下:

{

    "ID": 247,

    "fieldNames": [

        "SMID",

        "SMSDRIW",

        "SMSDRIN",

        "SMSDRIE",

        "SMSDRIS",

        "SMUSERID",

        "SMAREA",

        "SMPERIMETER",

        "SMGEOMETRYSIZE",

        "SQKM",

        "SQMI",

        "COLOR_MAP",

        "CAPITAL",

        "COUNTRY",

        "POP_1994",

        "CONTINENT"

    ],

    "fieldValues": [

        "247",

        "73.62005",

        "53.55374",

        "134.76846",

        "3.8537261",

        "0",

        "960.4537031350538",

        "6.685997649733246E7",

        "147412",

        "9367281.0",

        "3616707.25",

        "1",

        "北京",

        "中华人民共和国",

        "1.128139689E9",

        "亚洲"

    ],

    "geometry": null

}

示例2:EPS数据集类型

当要素所在数据集的类型为EPS,对 feature 资源执行 GET 请求后,将返回组成几何对象的点的属性信息。以 URI1 为例,构建 URI 如下:

http://supermapiserver:8090/iserver/services/data-China400/rest/data/datasources/EPS_all/datasets/PointEPS/features/1.rjson

则返回 ID 为1的要素的资源表述如下:

{

    "ID": 1,

    "fieldNames": [

        "SMID",

        "SMSDRIW",

        "SMSDRIN",

        "SMSDRIE",

        "SMSDRIS",

        "SMUSERID",

        "SMGEOMETRYSIZE",

        "SMGEOPOSITION"

    ],

    "fieldValues": [

        "1",

        "525.26154",

        "460.002",

        "525.26154",

        "460.002",

        "0",

        "0",

        "0"

    ],

    "geometry": {

        "center": null,

        "id": 1,

        "parts": [1],

        "points": [{

            "name": "",

            "type": "None",

            "x": 525.261530541407,

            "y": 460.00202477444,

            "z": 0

        }],

        "prjCoordSys": null,

        "style": null,

        "type": "POINTEPS"

    }

}

示例3:VIDEO数据集类型

当要素所在数据集的类型为VIDEO,对 feature 资源执行 GET 请求后,将返回视频要素的信息。以 URI1 为例,构建 URI 如下:

http://localhost:8090/iserver/services/data-test0104/rest/data/datasources/NewDatasource/datasets/ptz_2/features/1.rjson?hasGeometry=true

则返回 ID 为1的要素的资源表述如下:

{

    "stringID": null,

    "address": "http://192.168.113.1:8090/iserver/services/video-test0104/restjsr/hls/stream/NewDatasource-ptz_2/1/index.m3u8",

    "videoParameters": {

        "auxiliaryCalibrationParameter": {

            "tiltGrowsUp": false,

            "iterationCount": 1000,

            "samplesCount": 200,

            "supportHeight": false,

            "panGrowsClockwise": false,

            "cameraIteratorParameters": [

                {

                    "minValue": "NaN",

                    "cameraParameterType": "X",

                    "maxValue": "NaN",

                    "value": 1.29295170697E7

                },

                {

                    "minValue": "NaN",

                    "cameraParameterType": "Y",

                    "maxValue": "NaN",

                    "value": 3279448.7247

                },

                {

                    "minValue": 0,

                    "cameraParameterType": "Z",

                    "maxValue": 80,

                    "value": "NaN"

                },

                {

                    "minValue": "NaN",

                    "cameraParameterType": "FOV_X",

                    "maxValue": "NaN",

                    "value": "NaN"

                },

                {

                    "minValue": "NaN",

                    "cameraParameterType": "FOV_Y",

                    "maxValue": "NaN",

                    "value": "NaN"

                }

            ]

        },

        "videoParameterList": [

            {

                "videoWidth": 1540,

                "calibrationModel": {

                    "isRansac": false,

                    "centerY": 0,

                    "centerX": 0,

                    "calibrationModelType": 0,

                    "calibrationPoints": [

                        {

                            "spatialPoint": {

                                "x": 1.2929429979064863E7,

                                "y": 3279405.072826336,

                                "z": 0

                            },

                            "videoPoint": {

                                "x": 546,

                                "y": 196

                            }

                        },

                        {

                            "spatialPoint": {

                                "x": 1.2929372108815093E7,

                                "y": 3279432.230745163,

                                "z": 0

                            },

                            "videoPoint": {

                                "x": 855,

                                "y": 445

                            }

                        },

                        {

                            "spatialPoint": {

                                "x": 1.2929376742628248E7,

                                "y": 3279481.6986007923,

                                "z": 0

                            },

                            "videoPoint": {

                                "x": 1281,

                                "y": 414

                            }

                        },

                        {

                            "spatialPoint": {

                                "x": 1.2929298549258841E7,

                                "y": 3279409.595201617,

                                "z": 0

                            },

                            "videoPoint": {

                                "x": 694,

                                "y": 590

                            }

                        },

                        {

                            "spatialPoint": {

                                "x": 1.2929325804647576E7,

                                "y": 3279495.6764664766,

                                "z": 0

                            },

                            "videoPoint": {

                                "x": 1244,

                                "y": 534

                            }

                        },

                        {

                            "spatialPoint": {

                                "x": 1.2929358878926704E7,

                                "y": 3279505.9148433916,

                                "z": 0

                            },

                            "videoPoint": {

                                "x": 1409,

                                "y": 456

                            }

                        },

                        {

                            "spatialPoint": {

                                "x": 1.2929424599934718E7,

                                "y": 3279463.9504835536,

                                "z": 0

                            },

                            "videoPoint": {

                                "x": 1273,

                                "y": 217

                            }

                        },

                        {

                            "spatialPoint": {

                                "x": 1.2929371030474676E7,

                                "y": 3279383.6257988643,

                                "z": 0

                            },

                            "videoPoint": {

                                "x": 432,

                                "y": 448

                            }

                        }

                    ],

                    "fovX": 0,

                    "fovY": 0,

                    "isIntrinsic": false,

                    "isExtrinsic": false,

                    "cameraLocation": {

                        "cameraRoll": -0.7656412825751551,

                        "cameraYaw": -90.89065135311759,

                        "cameraY": 3279448.7247,

                        "cameraZ": 65.78334160898069,

                        "cameraX": 1.29295170697E7,

                        "cameraPitch": -39.80838777192129

                    }

                },

                "clipRegion": {

                    "center": {

                        "x": 770,

                        "y": 385

                    },

                    "parts": [5],

                    "style": null,

                    "prjCoordSys": null,

                    "id": 0,

                    "type": "REGION",

                    "partTopo": [1],

                    "points": [

                        {

                            "x": 0,

                            "y": 0

                        },

                        {

                            "x": 1540,

                            "y": 0

                        },

                        {

                            "x": 1540,

                            "y": 770

                        },

                        {

                            "x": 0,

                            "y": 770

                        },

                        {

                            "x": 0,

                            "y": 0

                        }

                    ]

                },

                "zoom": 1,

                "time": 0,

                "validBounds": {

                    "OUT_TOP": 2,

                    "OUT_RIGHT": 4,

                    "size": {

                        "width": 1540,

                        "height": 770

                    },

                    "x": 0,

                    "width": 1540,

                    "y": 0,

                    "OUT_BOTTOM": 8,

                    "location": {

                        "x": 0,

                        "y": 0

                    },

                    "OUT_LEFT": 1,

                    "height": 770

                },

                "tilt": 23.9,

                "pan": 156,

                "videoHeight": 770

            },

            {

                "videoWidth": 1540,

                "calibrationModel": {

                    "isRansac": false,

                    "centerY": 0,

                    "centerX": 0,

                    "calibrationModelType": 0,

                    "calibrationPoints": [

                        {

                            "spatialPoint": {

                                "x": 1.2929429979064863E7,

                                "y": 3279405.072826336,

                                "z": 0

                            },

                            "videoPoint": {

                                "x": 120,

                                "y": 126

                            }

                        },

                        {

                            "spatialPoint": {

                                "x": 1.2929371395548986E7,

                                "y": 3279432.6098156744,

                                "z": 0

                            },

                            "videoPoint": {

                                "x": 410,

                                "y": 442

                            }

                        },

                        {

                            "spatialPoint": {

                                "x": 1.2929377985228604E7,

                                "y": 3279478.5103589036,

                                "z": 0

                            },

                            "videoPoint": {

                                "x": 820,

                                "y": 444

                            }

                        },

                        {

                            "spatialPoint": {

                                "x": 1.2929298549258841E7,

                                "y": 3279409.595201617,

                                "z": 0

                            },

                            "videoPoint": {

                                "x": 228,

                                "y": 564

                            }

                        },

                        {

                            "spatialPoint": {

                                "x": 1.292926073318682E7,

                                "y": 3279503.7847872227,

                                "z": 0

                            },

                            "videoPoint": {

                                "x": 735,

                                "y": 641

                            }

                        },

                        {

                            "spatialPoint": {

                                "x": 1.2929358878926704E7,

                                "y": 3279505.9148433916,

                                "z": 0

                            },

                            "videoPoint": {

                                "x": 947,

                                "y": 504

                            }

                        },

                        {

                            "spatialPoint": {

                                "x": 1.2929424599934718E7,

                                "y": 3279463.9504835536,

                                "z": 0

                            },

                            "videoPoint": {

                                "x": 859,

                                "y": 262

                            }

                        },

                        {

                            "spatialPoint": {

                                "x": 1.2929388108285695E7,

                                "y": 3279545.695535939,

                                "z": 0

                            },

                            "videoPoint": {

                                "x": 1324,

                                "y": 465

                            }

                        },

                        {

                            "spatialPoint": {

                                "x": 1.2929322376055904E7,

                                "y": 3279573.704751997,

                                "z": 0

                            },

                            "videoPoint": {

                                "x": 1183,

                                "y": 579

                            }

                        }

                    ],

                    "fovX": 0,

                    "fovY": 0,

                    "isIntrinsic": false,

                    "isExtrinsic": false,

                    "cameraLocation": {

                        "cameraRoll": -0.7656412825751551,

                        "cameraYaw": -70.89065135311759,

                        "cameraY": 3279448.7247,

                        "cameraZ": 65.78334160898069,

                        "cameraX": 1.29295170697E7,

                        "cameraPitch": -39.80838777192129

                    }

                },

                "clipRegion": {

                    "center": {

                        "x": 770,

                        "y": 385

                    },

                    "parts": [5],

                    "style": null,

                    "prjCoordSys": null,

                    "id": 0,

                    "type": "REGION",

                    "partTopo": [1],

                    "points": [

                        {

                            "x": 0,

                            "y": 0

                        },

                        {

                            "x": 1540,

                            "y": 0

                        },

                        {

                            "x": 1540,

                            "y": 770

                        },

                        {

                            "x": 0,

                            "y": 770

                        },

                        {

                            "x": 0,

                            "y": 0

                        }

                    ]

                },

                "zoom": 1,

                "time": 12.733333333333333,

                "validBounds": {

                    "OUT_TOP": 2,

                    "OUT_RIGHT": 4,

                    "size": {

                        "width": 1540,

                        "height": 770

                    },

                    "x": 0,

                    "width": 1540,

                    "y": 0,

                    "OUT_BOTTOM": 8,

                    "location": {

                        "x": 0,

                        "y": 0

                    },

                    "OUT_LEFT": 1,

                    "height": 770

                },

                "tilt": 23.9,

                "pan": 136,

                "videoHeight": 770

            },

            {

                "videoWidth": 1540,

                "calibrationModel": {

                    "isRansac": false,

                    "centerY": 0,

                    "centerX": 0,

                    "calibrationModelType": 0,

                    "calibrationPoints": [

                        {

                            "spatialPoint": {

                                "x": 1.292947775352481E7,

                                "y": 3279486.5758288642,

                                "z": 0

                            },

                            "videoPoint": {

                                "x": 1111,

                                "y": 52

                            }

                        },

                        {

                            "spatialPoint": {

                                "x": 1.2929377985228604E7,

                                "y": 3279478.5103589036,

                                "z": 0

                            },

                            "videoPoint": {

                                "x": 374,

                                "y": 420

                            }

                        },

                        {

                            "spatialPoint": {

                                "x": 1.292926073318682E7,

                                "y": 3279503.7847872227,

                                "z": 0

                            },

                            "videoPoint": {

                                "x": 263,

                                "y": 611

                            }

                        },

                        {

                            "spatialPoint": {

                                "x": 1.2929358878926704E7,

                                "y": 3279505.9148433916,

                                "z": 0

                            },

                            "videoPoint": {

                                "x": 491,

                                "y": 499

                            }

                        },

                        {

                            "spatialPoint": {

                                "x": 1.2929424599934718E7,

                                "y": 3279463.9504835536,

                                "z": 0

                            },

                            "videoPoint": {

                                "x": 448,

                                "y": 248

                            }

                        },

                        {

                            "spatialPoint": {

                                "x": 1.2929388108285695E7,

                                "y": 3279545.695535939,

                                "z": 0

                            },

                            "videoPoint": {

                                "x": 860,

                                "y": 506

                            }

                        },

                        {

                            "spatialPoint": {

                                "x": 1.2929407825861763E7,

                                "y": 3279565.077638886,

                                "z": 0

                            },

                            "videoPoint": {

                                "x": 1046,

                                "y": 497

                            }

                        },

                        {

                            "spatialPoint": {

                                "x": 1.2929445928769993E7,

                                "y": 3279564.7923564096,

                                "z": 0

                            },

                            "videoPoint": {

                                "x": 1269,

                                "y": 418

                            }

                        }

                    ],

                    "fovX": 0,

                    "fovY": 0,

                    "isIntrinsic": false,

                    "isExtrinsic": false,

                    "cameraLocation": {

                        "cameraRoll": -0.7656412825751551,

                        "cameraYaw": -50.89065135311759,

                        "cameraY": 3279448.7247,

                        "cameraZ": 65.78334160898069,

                        "cameraX": 1.29295170697E7,

                        "cameraPitch": -39.80838777192129

                    }

                },

                "clipRegion": {

                    "center": {

                        "x": 770,

                        "y": 385

                    },

                    "parts": [5],

                    "style": null,

                    "prjCoordSys": null,

                    "id": 0,

                    "type": "REGION",

                    "partTopo": [1],

                    "points": [

                        {

                            "x": 0,

                            "y": 0

                        },

                        {

                            "x": 1540,

                            "y": 0

                        },

                        {

                            "x": 1540,

                            "y": 770

                        },

                        {

                            "x": 0,

                            "y": 770

                        },

                        {

                            "x": 0,

                            "y": 0

                        }

                    ]

                },

                "zoom": 1,

                "time": 23.266666666666666,

                "validBounds": {

                    "OUT_TOP": 2,

                    "OUT_RIGHT": 4,

                    "size": {

                        "width": 1540,

                        "height": 770

                    },

                    "x": 0,

                    "width": 1540,

                    "y": 0,

                    "OUT_BOTTOM": 8,

                    "location": {

                        "x": 0,

                        "y": 0

                    },

                    "OUT_LEFT": 1,

                    "height": 770

                },

                "tilt": 23.9,

                "pan": 116,

                "videoHeight": 770

            }

        ],

        "parameterInterpolation": false

    },

    "fieldNames": [

        "SMID",

        "SMUSERID"

    ],

    "name": "ptz旋转画面.mp4",

    "startTime": "2023/11/22 09:16:51",

    "geometry": {

        "center": {

            "x": 1.292926198036702E7,

            "y": 3279399.5618885513

        },

        "parts": [5],

        "style": null,

        "prjCoordSys": null,

        "id": 1,

        "type": "REGION",

        "partTopo": [1],

        "points": [

            {

                "x": 1.2929466274270147E7,

                "y": 3279386.794475903

            },

            {

                "x": 1.2929463599646807E7,

                "y": 3279488.8953134995

            },

            {

                "x": 1.2929031336155694E7,

                "y": 3279642.3491254174

            },

            {

                "x": 1.292908470565614E7,

                "y": 3279156.774651685

            },

            {

                "x": 1.2929466274270147E7,

                "y": 3279386.794475903

            }

        ]

    },

    "endTime": "2023/11/22 09:16:58",

    "fieldValues": [

        "1",

        "0"

    ],

    "ID": 1,

    "cameraLocation": {

        "cameraRoll": -0.7656412825751551,

        "cameraYaw": -90.89065135311759,

        "cameraY": 3279448.7247,

        "cameraZ": 65.78334160898069,

        "cameraX": 1.29295170697E7,

        "cameraPitch": -39.80838777192129

    }

}

PUT 请求

修改一个要素(当要素类型为点、线、面、文本、复合数据集或纯属性表数据集、三维模型数据集和视频数据集时)。需要注意的是,SuperMap 系统字段,即字段名以 SM、sm 开头的字段,是只读字段,不允许被修改。

此外,若您修改的要素在当前数据集中不存在,当您传入的请求体参数与当前数据集的要素类型对应时,将创建一个新的要素;当请求体参数与当前数据集的要素类型不对应时,将返回出错信息。

对于视频要素,当前仅支持修改视频地址 address 参数和视频名称 name 参数。若您修改的要素在当前数据集中不存在,将返回出错信息。

请求参数

对 feature 资源执行 PUT 请求,对本要素进行修改,需要在请求体中包含修改后的要素的描述,请求体结构如下:

名称 类型 含义
fieldNames String[] 预修订的要素属性字段名集合。SuperMap 系统字段,即字段名以 SM、sm 开头的字段,是只读字段,不允许被修改。
fieldValues String[] 预修订的要素的属性字段值集合,与 fieldNames 对应。
geometry Geometry 要素对应的几何对象。

响应结构

对 feature 资源执行 PUT 请求,返回的操作结果表述的结构如下(表述在响应消息的实体主体里):  

字段 类型 说明
succeed boolean 操作是否成功。
error HttpError 出错信息,如果操作成功,则没有本字段。

示例

对示例 feature 资源:http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/Countries/features/247.rjson 执行 PUT 请求,修改 POP_1994 字段的值为 1,600,000,000,即1.6E9,请求体中包含参数如下:

{

    "ID": 247,

    "fieldNames": [

        "POP_1994"

    ],

    "fieldValues": [

        "1.6E9"

    ]

}

则操作成功时,返回 rjson 的操作结果的表述如下:

{"succeed": true}

DELETE 请求

删除 feature 资源所标识的要素(当要素类型为点、线、面、文本、复合数据集或纯属性表数据集时)。

请求参数

无。

响应结构

对 feature 资源执行 DELETE 请求,删除该 feature 资源(也就是一个要素),返回的操作结果的表述结构如下:

字段 类型 说明
succeed boolean 删除要素是否成功
error HttpError 出错信息,如果操作成功,则没有本字段。

示例

对示例 feature 资源:http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/Countries/features/247.rjson 执行 DELETE 请求,删除 World 数据源 Countries 数据集中 ID 为 247 的要素,在删除成功的情况下,返回的操作结果的表述如下:

{"succeed": true}

HEAD 请求

返回跟 GET 请求一样的 HTTP 响应头,但是没有响应实体。可以在不必传输整个响应内容的情况下,获取包含在响应消息头中的元数据信息。元数据信息包括媒体类型,字符编码,压缩编码,实体内容长度等。

HEAD 请求可以用来判断 feature 资源是否存在,或者客户端是否有权限访问 feature 资源。通过对加.<format>的 URI 执行 HEAD 请求,还可以快速判断 feature 资源是否支持<format>格式的表述。

请参见