features


URI

<dataset_uri>/features[.<format>]

Supported methods

GET, POST, HEAD

Parent resource

dataset

Child resources

feature

Introduction

The features resource represents a collection of all the features in a dataset. By executing the GET request on the features resource, you can get the list of features in the dataset. When the dataset is a point, line or region dataset, executing the POST request on the features resource can add, remove, or modify the features in the dataset.

Please refer to the development guide for more information about this resource usage:Add Feature.

Supported methods

Supported output formats: RJSON、JSON、HTML、XML、KML、GeoRSS、GeoJSON。

Note: The GeoJSON representation is available when the feature type is point, line or polygon.

GIS Services Resource Hierarchy

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

HTTP request methods

Below is an example of performing an HTTP request on a specified URI with rjson as the output format. supermapiserver in the URI is the name of the server.

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

GET Request

Gets the collection of the feature information, including the number of features in the dataset, geometric object type, URI of each feature, etc.

Request parameters

Parameters needed when executing the GET request on the features resource to get the dataset information collection include:

Field Type Definition
fromIndex int The starting index of the feature information collection. The default value is 0.
toIndex int The ending index of the feature information collection. The default value is 19.

Surely, no parameter could make it. executing the GET on the features resource, with no parameters specified in the URI, will return the collection of feature information with index number from 0 to 19.

Response structure

When executing the GET request on the features resource, the representation of the resource returned is included in the entity body of the response message, as shown below:

Name Type Description
featureCount int The number of features in the dataset.
GeometryType GeometryType The feature type.
childUriList List<String> List<String>The URI list for features.
startIndex int The start position of the feature in the collection. The value is euqal to fromIndex specified during the request.

Example usage

Execute the GET request on the features resource and specify the fromIndex and toIndex parameters in the URI:

http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/Countries/features.rjson?fromIndex=50&toIndex=55

The response in json format is as follows:

{

    "childUriList": [

        "http://supermapiserver:8090/iserver/services/data-world/rest/data/feature/0-13-50",

        "http://supermapiserver:8090/iserver/services/data-world/rest/data/feature/0-13-51",

        "http://supermapiserver:8090/iserver/services/data-world/rest/data/feature/0-13-52",

        "http://supermapiserver:8090/iserver/services/data-world/rest/data/feature/0-13-53",

        "http://supermapiserver:8090/iserver/services/data-world/rest/data/feature/0-13-54",

        "http://supermapiserver:8090/iserver/services/data-world/rest/data/feature/0-13-55"

    ],

    "featureCount": 247,

    "geometryType": "REGION"

}

Execute the GET request on the features resource with http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/Capitals/features.kml to get the response in kml format, as shown below: Below is the effect you will get when accessing the kml service in GoogleEarth.

POST Requests

When performing add, delete (_method=DELETE) or modify (_method=PUT) operations on dense area of features (whose dataset is point/ line/ region datasets, text datasets, CAD datasets or tabular datasets), iServer supports asynchronous submission method to handle the edit operations, without blocking the current thread to wait for the completion of the operation. You can Set asynchronous submission in the service config file.

Request parameters

The features resource represents a collection of all the features in a dataset. By default, the POST request creates new features. However, the following parameters could be included in the URI to control the operation.

Note: 3D model dataset doesn't support creating features.

Parameters in the URI are as follows:

Field Type Definition
isUseBatch boolean [Optional]
Whether to use the bulk addition of features. This function is active for adding features.
The bulk addition function can improve the editing efficiency of features.
True denotes to use the bulk addition function; false denotes not to use this function. The default "no transfer" is false.
returnContent boolean [Optional] ?rh-implicit_p ?> This function is active for adding features, and isUseBatch has not been converted or converted into false.
True represents returning newly created ID array of the features, and false represents returning the URI of created featureResult resource. The default is false.
_method String The functions POST should realize. Available values include GET, PUT, POST, DELETE, HEAD, which corresponds to HTTP requests respectively.
_method could be valued as DELETE or PUT, respectively indicating removing or modifying the features.

When executing the POST request on the features resource to add or modify features, the information collection of features to be added or modified needs to be included in the request body. The information structure of each feature is as follows:

Field Type Definition
fieldNames String[] A feature's attribute field name set. System field is the default field and can't edited by users,the contents can't be modified except SMUSERID. For information about different dataset system fields, see fields resources.
fieldValues String[] The field value collection.
geometry geometry The geometric object corresponding to the feature.

When deleting a feature (_method=DELETE), the ID array of the features to be deleted or the SQL query condition should be contained in the request body. The request body is as follows:

Field Type Definition
IDs int[] The ID array of the features to be deleted when deleting by ID array.
attributeFilter String SQL query conditions when deleting by SQL method.

Response structure

When executing the POST request on the features resource to add, modify , or delete dataset, the response is as follows:

Invalid when isUseBatch is tre.
Name Type Description
succeed boolean If the operation was successful.
newResourceID string The ID of the newly created featureResult resource.
newResourceLocation string The URI of the newly created featureResult resource.
error HttpError An error message, if the operation is successful, you do not have this field.

Example usage

Execute the POST request on the sample features resource, that is, the feature collection of the countries dataset in the World datasource.

  1. Create new feature

Perform POST request to URI:http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/Countries/features.rjson?isUseBatch=true with the request entity as follows:

[

    {

        "fieldNames": [

            "SMID",

            "SMSDRIW",

            "SMSDRIN",

            "SMSDRIE",

            "SMSDRIS",

            "SMUSERID",

            "SMAREA",

            "SMPERIMETER",

            "SMGEOMETRYSIZE",

            "SQKM",

            "SQMI",

            "COLOR_MAP",

            "CAPITAL",

            "COUNTRY",

            "POP_1994",

            "CONTINENT"

        ],

        "fieldValues": [

            "22",

            "-7.433472633361816",

            "62.35749816894531",

            "-6.38972282409668",

            "61.388328552246094",

            "6",

            "0.25430895154659083",

            "5.743731026651685",

            "4500",

            "1474.69",

            "569.38",

            "5",

            "Sample capital a",

            "Sample country a",

            "47067.0",

            "Asia"

        ],

        "geometry": {

            "id": 22,

            "parts": [

                3

            ],

            "points": [

                {

                    "x": -40,

                    "y": 60

                },

                {

                    "x": -45,

                    "y": 62

                },

                {

                    "x": -40,

                    "y": 55

                },

                {

                    "x": -40,

                    "y": 60

                }

            ],

            "style": null,

            "type": "REGION"

        }

    }

]

[

    {

        "fieldNames": [

            "SMID",

            "SMSDRIW",

            "SMSDRIN",

            "SMSDRIE",

            "SMSDRIS",

            "SMUSERID",

            "SMAREA",

            "SMPERIMETER",

            "SMGEOMETRYSIZE",

            "SQKM",

            "SQMI",

            "COLOR_MAP",

            "CAPITAL",

            "COUNTRY",

            "POP_1994",

            "CONTINENT"

        ],

        "fieldValues": [

            "23",

            "-7.433472633361816",

            "62.35749816894531",

            "-6.38972282409668",

            "61.388328552246094",

            "6",

            "0.25430895154659083",

            "5.743731026651680",

            "4500",

            "1474.69",

            "569.38",

            "5",

            "Capitalb",

            "Countrb",

            "47067.0",

            "Asia"

        ],

        "geometry": {

            "id": 23,

            "parts": [

                3

            ],

            "points": [

                {

                    "x": -40,

                    "y": 60

                },

                {

                    "x": -45,

                    "y": 62

                },

                {

                    "x": -40,

                    "y": 55

                },

                {

                    "x": -40,

                    "y": 60

                }

            ],

            "style": null,

            "type": "REGION",

            "prjCoordSys":null

        }

    }

]

If successful, the response in json format is as follows:

{

    "newResourceLocation": "null.rjson",

    "postResultType": "CreateChild",

    "succeed": true

}

Execute the POST request on URI:http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/Countries/features.rjson with the request entity as follows:

[

    {

        "fieldNames": [

            "SMID",

            "SMSDRIW",

            "SMSDRIN",

            "SMSDRIE",

            "SMSDRIS",

            "SMUSERID",

            "SMAREA",

            "SMPERIMETER",

            "SMGEOMETRYSIZE",

            "SQKM",

            "SQMI",

            "COLOR_MAP",

            "CAPITAL",

            "COUNTRY",

            "POP_1994",

            "CONTINENT"

        ],

        "fieldValues": [

            "22",

            "-7.433472633361816",

            "62.35749816894531",

            "-6.38972282409668",

            "61.388328552246094",

            "6",

            "0.25430895154659083",

            "5.743731026651685",

            "4500",

            "1474.69",

            "569.38",

            "5",

            "Sample capital",

            "Sample country",

            "47067.0",

            "Asia"

        ],

        "geometry": {

            "id": 22,

            "parts": [

                3

            ],

            "points": [

                {

                    "x": -40,

                    "y": 60

                },

                {

                    "x": -45,

                    "y": 62

                },

                {

                    "x": -40,

                    "y": 55

                },

                {

                    "x": -40,

                    "y": 60

                }

            ],

            "style": null,

            "type": "REGION",

            "prjCoordSys":null

        }

    }

]

If successful, the response in json format is as follows:

{

    "newResourceID": "1",

    "newResourceLocation": "http://supermapiserver:8090/iserver/services/data-world/rest/data/featureResults/1.rjson",

    "succeed": true

}

When the dataset type is EPS,performing POST request on features requires to add attribute information for each point, including name" and “type”. For example, performing a POST reuqest on features resource ttp://supermapiserver:8090/iserver/services/data-China400/rest/data/datasources/EPS_all/datasets/PointEPS/features.rjson with the request entity as shown below:

[

  {

    "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": "point1",

            "type": "None",

            "x": 525.261530541407,

            "y": 460.00202477444,

            "z": 0

        }],

        "prjCoordSys": null,

        "style": null,

        "type": "POINTEPS"

    }

  }

]

Note: When creating point features, "type" is optional; when creating line or region features, "type" is mandatory. For details, see: PointEPSType

If the creation is successful, the returned result in rjson format is as follows:

{

    "newResourceID": "1",

    "newResourceLocation": "http://supermapiserver:8090/iserver/services/data-China400/rest/data/featureResults/1.rjson",

    "succeed": true

}

  1. Edit features

Perform POST request to URI:http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name//datasets/name/Countries/features.rjson?_method=PUT to modify the geometries with the request entity shown below:

[

    {

        "fieldNames": [

            "SMID",

            "SMSDRIW",

            "SMSDRIN",

            "SMSDRIE",

            "SMSDRIS",

            "SMUSERID",

            "SMAREA",

            "SMPERIMETER",

            "SMGEOMETRYSIZE",

            "SQKM",

            "SQMI",

            "COLOR_MAP",

            "CAPITAL",

            "COUNTRY",

            "POP_1994",

            "CONTINENT"

        ],

        "fieldValues": [

            "22",

            "-7.433472633361820",

            "62.35749816894530",

            "-6.38972282409668",

            "61.388328552246100",

            "6",

            "0.25430895154659100",

            "5.743731026651680",

            "4500",

            "1474.69",

            "569.38",

            "5",

            "Sample capital",

            "Sample country",

            "47067.0",

            "Europe"

        ],

        "geometry":

            "id": 22,

            "parts": [

                3

            ],

            "points": [

                {

                    "x": -40,

                    "y": 60

                },

                {

                    "x": -45,

                    "y": 70

                },

                {

                    "x": -40,

                    "y": 55

                },

                {

                    "x": -40,

                    "y": 60

                }

            ],

            "style": null,

            "type": "REGION",

            "prjCoordSys":null

        }

    }

]

If successful, the response in json format is as follows:

"succeed": true,

If the dataset type is EPS, you also can send PUT request to modify the geometries. Perform PUT request to URI:http://supermapiserver:8090/iserver/services/data-China400/rest/data/datasources/EPS_all/datasets/PointEPS/features.rjson?_method=PUT with the request entity shown below:

[

  {

    "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": "point1",

            "type": "None",

            "x": 515.261530541407,

            "y": 436.00202477444,

            "z": 0

        }],

        "prjCoordSys": null,

        "style": null,

        "type": "POINTEPS"

    }

  }

]

If the modification is successful, the returned result representation in rjson format is shown below:

{"succeed": true}

  1. Delete features by ID array

Perform POST request to URI:http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/Countries/features.rjson?_method=DELETE &deleteMode=IDS with the request entity shown below to delete features whose ID equal to 51 or 52:

[51,52]

If the operation is successful, the returned result representation in rjson format is as follows:

{"succeed": true}

At this point, if perorming GET request on a feature resource with an ID of 51 or 52, it will show the feature resources of ID=51 or ID=52 no longer exist.

  1. Delete features by SQL conditions

Perform POST request to URI:http://supermapiserver:8090/iserver/services/data-world/rest/data/datasources/name/World/datasets/name/Countries/features.rjson?_method=DELETE &deleteMode=SQL with the request entity shown below to delete the features where SmID<10 :

{"attributeFilter":"SmID %26lt; 10"}

If the deletion is successful, the returned result representation in rjson format is as follows:

{"succeed": true}

HEAD Request

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 features resource exists, or if the features resource can be accessed by clients. It can also determine if the features resource supports an output format <format> if performing on a URI with .<format> included.

 

See