featureResults


URI

/featureResults[.<format>]

Supported methods

GET, POST, HEAD

Parent resource

data

Child resources

featureResult

Introduction

The featureResults resource represents the collection of data query results. By performing a POST request on featureResults resource, you can query data from the datasource (or across the datasources) and get the expected features. Query steps are as follows:

  1. Performing a POST request on the featureResults resource with required parameters contained in the request body, the system will return the URI of the result resource (featureResult resource);

  2. Perform a GET request with the returned URI to get the specific results.

There are a series of modes to get the feature collection: ID, SQL, BOUNDS, BOUNDS_ATTRIBUTEFILTER, BUFFER and BUFFER_ATTRIBUTEFILTER.

For details about the usage of this resource, see: Buffer Query for Data Feature.

Supported methods

Supported output formats: RJSON, JSON, HTML, XML.

Resource Hierarchy

root data featureResults.htm

HTTP request methods

Execute a HTTP request on the following URI, here we take rjosn as the output format as an example. Where, supermapiserver is the server name.

http://supermapiserver:8090/iserver/services/data-China400/rest/data/featureResults.rjson

GET Request

Gets the collection of the data query result resource.

Request parameters

None.

Response structure

After executing a GET request on featureResults resource, the response entity is a collection of the data query result information, and the response fields of single featureResult are as follows:

Name Type Description
name String The name of the featureResult resource.
path String The access path of the featureResult resource.
resourceConfigID String ID of the resource configuration.
resourceType String Resource type.
supportedMediaTypes String[] The media-type of the supported representation.

Example usage

The featureResults resource saves the information of the query results in a successful query (ie., after performing a POST request successfully on the featureResults resource). Perform a GET request on the featureResults resource, the returned resource description in rjson format is as follows:

[

   {

        "name": "c97763682c0f4eebb392a704ab8273b2_8fe12768e9244972bd4c051fde8b53ee",

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

        "resourceConfigID": null,

        "resourceType": "ArithResultResource",

        "supportedMediaTypes": [

            "application/xml",

            "text/xml",

            "application/json",

            "application/fastjson",

            "application/rjson",

            "text/html",

            "application/jsonp",

            "application/x-java-serialized-object"

        ]

    }

]

POST request

creates a data query result resource according to the given conditions.

Request parameters

Implement the POST request on the featureResults resource. Query data (create a featureResult resource) and the parameters required to pass see as follows:

Parameters in URI

Field Type Definition
returnContent boolean True represents to return the query results directly (Element type is Feature array). False represents to return the featureResult resource URL created. The default is false.
fromIndex int The minimum index number of the query results.
The default value is 0. The query result is empty if the value is greater than the maximum index of the query result.
toIndex int The maximum index number of the query results.
The maximum index number of the query result is the terminated index number if the value is greater than the maximum index of the query result.

 

Request body parameters

The request body contains the query parameters seeing as follows. Among them, gerFeatureMode identifies the data query mode. Different data query mode needs different parameters.

Field Type Definition
getFeatureMode getFeatureMode [Required]
Data query pattern, includes ID, SQL, BOUNDS, BOUNDS_ATTRIBUTEFILTER, BUFFER, BUFFER_ATTRIBUTEFILTER, SPATIAL, SPATIAL_ATTRIBUTEFILTER etc.
If implement query on 3D point ,line ,region dataset, the query types supported are ID, SQL, BOUNDS, BOUNDS_ATTRIBUTEFILTER, BUFFER and BUFFER_ATTRIBUTEFILTER.
datasetNames String[] [Required]
The dataset name array (datasourceName: datasetName).
\tab \tab \tab The dataset name is the combination of the datasource name and the dataset name. For the Ocean dataset in the World datasource, the dataset name is World:Ocean.
ids int[] The ID array of the obtained resources. Required
when getFeatureMode is ID.
bounds Rectangle2D The rectangle extent required when implement extent query.
Required when the value of getFeatureMode is BOUNDS or BOUNDS_ATTRIBUTEFILT.
geometry geometry The geometric object. Required
when getFeatureMode is BUFFER, BUFFER_ATTRIBUTEFILTER, SPATIAL, or SPATIAL_ATTRIBUTEFILTER.
bufferDistance double The buffer distance. The unit is consistant with the unit of the dataset coordinate. Required
when getFeatureMode is BUFFER or BUFFER_ATTRIBUTEFILTER.
attributeFilter string The attribute query filter. Required
when getFeatureMode is BUFFER_ATTRIBUTEFILTER or Spatial_AttributeFilter.
spatialQueryMode spatialQueryMode The spatial query mode. Required
when getFeatureMode is Spatial or Spatial_AttributeFilter.
maxFeatures int The count of returned query result items used to set the server when it is SQL query. The default value is 1000.
queryParameter queryParameter The query parameters.
It contains the field names set to obtain. Required when getFeatureMode is SQL.
targetPrj PrjCoordSys

The target coordinate system of dynamic projection.

Dynamic projection is used when the returned queried results are in a different coordinate system, which means the original coordinate system of the result is the same as it's dataset, but you want the result in another coordinate system. At this point, dynamic projection is used. And you need set the target coordinate system.

Here you can set in two ways. One is targetPrj which is rjCoordSys type, the other is targetEpsgCode, which is int type and it indicates the EPSG Code corresponding to the target coordinate system.

It is recommended to use targetPrj when there is no corresponding EpsgCode in the target coordinate system.

Note, when using any of the two parameters to set target coordinate system, you need add returnContent parameter with true as the value in the request url; and if the both parameters are set, the targetEpsgCode shall be used.

targetEpsgCode int The EPSG Code corresponding to the target coordinate system.

Response structure

Implement a POST request on the featureResults resource, and the structure of the returned results sees as follows:

Name Type Description
succeed boolean Whether the query is successful.
newResourceID string The ID of the newly created featureResult resource.
newResourceLocation string The URI of the newly created featureResult resource.

If the returnContent parameter of URI is true, the results feature collection, or the Feature collection, will be returned. The structure of a single element sees as follows:

Field Type Definition
ID int The ID of the feature.
fieldNames String[] The field collection.
fieldValues String[] The field value collection.
geometry geometry The geometric object corresponding to the feature.

Example 1

Implement the POST request (the default value of returnContent is false) on the featureResults resource with http://supermapiserver:8090/iserver/services/data-world/rest/data/featureResults.rjson to get feature by ID by querying data on supermapiserver. Parameters in the request body are as follows:

{

"getFeatureMode":"ID",

"datasetNames":["World:Capitals"],

"ids":[1, 2, 3]

}

The returned results representation in rjson format is as follows:

{

    "newResourceID": "48ba8fa1144640939a944f75e1682265_99dabf94794248c38776711d859164af",

    "newResourceLocation": "http://localhost:8080/iserver/services/data-world/rest/data/featureResults/48ba8fa1144640939a944f75e1682265_99dabf94794248c38776711d859164af.rjson",

    "postResultType": "CreateChild",

    "succeed": true

}

Example 2: Query and return features in a different coordinate system (Use targetEpsgCode parameter)

Perform POST request on the sample resource featureResults: http://supermapiservert:8090/iserver/services/data-China400/rest/data/featureResults.rjson?returnContent=true to query data on the supermapiserver server, with the request entity as follows which sets getting features by SQL and sets the target coordinate system with targetEpsgCode parameter:

{

"getFeatureMode":"SQL",

"datasetNames":["World:Capitals"],

"targetEpsgCode":3857,

"maxFeatures":1000,

"queryParameter":{

     "sortClause":null,

     "ids":null, "name":"Capital",

     "attributeFilter":"SMID%26lt;5",

     "groupClause":null,

     "linkItems":null,

     "joinItems":null,

     "fields":null

  }

 }

The returned result representation with rjson as the output format is as follows:

{

    "featureCount": 1,

    "featureUriList": [],

    "features": [{

        "ID": 1,

        "fieldNames": [

            "SMID",

            "SMX",

            "SMY",

            "SMLIBTILEID",

            "SMUSERID",

            "SMGEOMETRYSIZE",

            "USERID",

            "POP",

            "CAPITAL_LO",

            "CAPITAL_CH",

            "COUNTRY_CH",

            "CAPITAL_EN",

            "COUNTRY_EN",

            "COUNTRY",

            "CAP_POP",

            "CAPITAL"

        ],

        "fieldValues": [

            "1",

            "-47.8977476573595",

            "-15.792110943058866",

            "1",

            "0",

            "16",

            "0",

            "2207718.0",

            "Brasília",

            "巴西利亚",

            "巴西",

            "Brasilia",

            "Brazil",

            "巴西",

            "2207718.0",

            "巴西利亚"

        ],

        "geometry": {

            "center": {

                "x": -5331952.879361972,

                "y": -1780660.5109428319

            },

            "id": 1,

            "parts": [1],

            "points": [{

                "x": -5331952.879361972,

                "y": -1780660.5109428319

            }],

            "prjCoordSys": null,

            "style": null,

            "type": "POINT"

        }

    }],

    "totalCount": 1

}

Example 3: Query and return features in a different coordinate system (Use targetPrj parameter)

Perform POST request on the sample resource featureResults: http://supermapiservert:8090/iserver/services/data-world/rest/data/featureResults.rjson?returnContent=true to query data on the supermapiserver server, with the request entity as follows which sets getting features by SQL and sets the target coordinate system with targetPrj. How to construct targetPrj parameter, refer to rjCoordSys.

{

"getFeatureMode":"SQL",

"targetPrj": {

            "coordSystem": {

                "datum": {

                    "name": "D_Timbalai_1948",

                    "spheroid": {

                        "axis": 6377298.556,

                        "flatten": 0.003324448999999486,

                        "name": "Everest_Definition_1967",

                        "type": "SPHEROID_EVEREST_DEF_1967"

                    },

                    "type": "DATUM_TIMBALAI_1948"

                },

                "name": "GCS_Timbalai_1948",

                "primeMeridian": {

                    "longitudeValue": 0,

                    "name": "Greenwich",

                    "type": "PRIMEMERIDIAN_GREENWICH"

                },

                "spatialRefType": "SPATIALREF_EARTH_LONGITUDE_LATITUDE",

                "type": "GCS_TIMBALAI_1948",

                "unit": "DEGREE"

            },

            "coordUnit": "METER",

            "distanceUnit": "METER",

            "epsgCode": 29873,

            "name": "Timbalai_1948_RSO_Borneo_Meters",

            "projection": {

                "name": "",

                "type": "PRJ_RECTIFIED_SKEWED_ORTHOMORPHIC"

            },

            "projectionParam": {

                "azimuth": 53.31582047908623,

                "centralMeridian": 115,

                "centralParallel": 4,

                "falseEasting": 2000000,

                "falseNorthing": 5000000,

                "firstPointLongitude": 0,

                "firstStandardParallel": 0,

                "scaleFactor": 0.99984,

                "secondPointLongitude": 0,

                "secondStandardParallel": 0,

                "rectifiedAngle":53.13010235415598

            }},

"datasetNames":["World:Capitals"],

"maxFeatures":1000,

"queryParameter":{"sortClause":null, "ids":null, "name":"Capital", "attributeFilter":"SMID%26lt;2", "groupClause":null, "linkItems":null, "joinItems":null, "fields":null}

}

The returned result representation with rjson as the output format is as follows:

{

    "featureCount": 1,

    "featureUriList": [],

    "features": [{

        "ID": 1,

        "fieldNames": [

            "SMID",

            "SMX",

            "SMY",

            "SMLIBTILEID",

            "SMUSERID",

            "SMGEOMETRYSIZE",

            "USERID",

            "POP",

            "CAPITAL_LO",

            "CAPITAL_CH",

            "COUNTRY_CH",

            "CAPITAL_EN",

            "COUNTRY_EN",

            "COUNTRY",

            "CAP_POP",

            "CAPITAL"

        ],

        "fieldValues": [

            "1",

            "-47.8977476573595",

            "-15.792110943058866",

            "1",

            "0",

            "16",

            "0",

            "2207718.0",

            "Brasília",

            "巴西利亚",

            "巴西",

            "Brasilia",

            "Brazil",

            "巴西",

            "2207718.0",

            "巴西利亚"

        ],

        "geometry": {

            "center": {

                "x": 4379183.5624869745,

                "y": 6771032.568773773

            },

            "id": 1,

            "parts": [1],

            "points": [{

                "x": 4379183.5624869745,

                "y": 6771032.568773773

            }],

            "prjCoordSys": null,

            "style": null,

            "type": "POINT"

        }

    }],

    "totalCount": 1

}

HEAD request

Returns the same HTTP response header as the GET request, but no response entity, which can be used to retrieve the meta data contained in response message header without having to transmit the entire response content. Meta data information includes media type, character coding, compression coding, entity content length, etc.

HEAD request is used to determine whether the featureResults resource exists, or if the client has the authority to access it. By executing an HEAD request with a .<format> URI, you can quickly determine whether the featureResults resource supports the <format> representation.

See