The feature resource represents a feature. You are allowed to acquire, modify, delete features (you can only modify and delete when the feature type is point, line, region, text, CAD or tabular).
The feature resource can be acquired through the ID number (URI1) of the feature or the index number (URI2) of the feature.
Note: URI2 is a simplified URI to access features, which directly connects datasource, dataset and feature index at the end with "-" connection to determine a feature. In the sample URI, {datasourceIndex} represents the datasource index, {datasetIndex} represents the dataset index, {featureIndex} represents the feature index. For example: http://supermapiserver:8090/iserver/services/data-world/rest/data/feature/0-2-7 means the feature with id 7 in the dataset with index 2 under the datasource with index 0. The URI has 5 representation formats: rjson, json, html, xml, kml.
Supported Methods:
Supported output formats: RJSON, JSON, HTML, XML, KML, GeoRSS amd GeoJSON.
Note: The GeoJSON representation is available when the feature type is point, line or polygon.
Execute the HTTP request on the following URI, where supermapiserver is the server name, with rjson being the output format.
http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/Countries/features/featureid.rjson
Get the information of a feature, including the attribute field name list, attribute field value list, and geometry object corresponding to the feature.
To acquire feature information through executing the GET request on feature resource, following parameters can be included in the URI:
Name | Type | Description |
hasGeometry | boolean | Whether to get geometry object information, with true indicating to contain geometry object information in the representation and false indicating not to contain geometry information. The default value is true. |
If there are no parameters passed, geometry information will be contained by default if you execute the GET request on the feature resource.
If you execute the GET request on the feature resource, the returned resource representation is as follows:
Name | Type | Description |
ID | int | Feature ID. |
fieldNames | String[] | The collection of feature attribute fields. |
fieldValues | String[] | The collection of feature attribute fields. |
geometry | Geometry | The geometry object corresponding to the feature. Sepecifially including: the type of geometric object, the stype of geometric object, the coordinates which compose the geometric object of a feature. |
If we want to execute the GET request on the sample feature resource and geometry information will not included in the returned result, taking URI1 as an example, then we need to construct URI as follows:,
http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/Countries/features/247.rjson?hasGeometry=false
The representation of the returned feature with ID 247 is as follows:
{
"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.4537031350540",
"6.685997649733246E7",
"147412",
"9367281.0",
"3616707.25",
"1",
"Beijing",
"China",
"1.128139689E9",
"Asia"
],
"geometry": null
}
If the dataset type of the feature is EPS, when performing GET request on feature resource, it will return attribute information of points which compose the geometric object of the feature. For example, build a URI: http://supermapiserver:8090/iserver/services/data-China400/rest/data/datasources/EPS_all/datasets/PointEPS/features/1.rjson, by sending it, the feature resource representation whose ID=1 will be returned:
{
"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"
}
}
Modify a feature (when the feature type is point, line, region, text, CAD dataset, tabular dataset or 3D model dataset). Note: SuperMap system fields which start with SM or sm are read-only fields and are not allowed to modified.
To perform the PUT request to modify the feature, you need to include the description of feature after modification, with request body as follows:
Name | Type | Description |
fieldNames | String[] | The collection of feature fields to be modified. SuperMap system fields, which were started with SM, sm are read-only and cannot be modified. |
fieldValues | String[] | The collection of fields to be modified, which corresponds to fieldNames. |
geometry | Geometry | The geometry object corresponding to the feature. |
If you perform the PUT request on the feature resource, the returned representation is as follows:
Field | Type | Description |
succeed | boolean | Whether the operation is successful. |
error | HttpError | Error information. If the operation is successful, the field does not exist. |
To perform the PUT request on sample feature resource http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/Countries/features/247.rjson to modify the value of the POP_1994 field to 1,600,000,000, that is, 1.6E9, then the request body should contain following parameters:
{
"ID": 247,
"fieldNames": [
"POP_1994"
],
"fieldValues": [
"1.6E9"
]
}
If the operation is successful, the representation of the result in rjson is as follows:
{"succeed": true}
Deletes features identified by the feature resource (when the feature type is point, line, region, text, CAD or tabular).
None.
When you perform the DELETE request on the feature resource to delete the feature resource, the structure of the returned representation is as follows:
Field | Type | Description |
succeed | boolean | Whether the operation is successful or not. |
error | HttpError | Error information. If the operation is successful, the field does not exist. |
When you perform the DELETE request on the sample feature resource http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/Countries/features/247.rjson to delete feature with ID 247 in the Countries dataset under World datasource, the representation of the result when the operation is successful is as follows:
{"succeed": true}
Asks for the response identical to the one that would correspond to a GET request, but without the response body. This is useful for retrieving meta-information written in response headers, without having to transport the entire content. The meta-information includes the media-type, content-encoding, transfer-encoding, content-length, etc.
HEAD request can be used to check if the feature resource exists, or if the feature resource can be accessed by clients. It can also determine if the clusterCfeature onfig resource supports an output format <format> if performing on a URI with .<format> included.