grid


URI

<buildindex_uri>/grid[.<format>]

Supported methods

GET, POST, HEAD

Parent resource

buildindex

Child resources

gridJob

Introduction

The directory of creating grid index job. By sending a GET request to grid, you can get the list of the creating grid index jobs of the current system. By sending a POST request, you can create a analysis task.

Supported Methods:

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

Resource hierarchy

HTTP request methods

Execute 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/distributedanalyst/rest/v1/jobs/dataprocessing/buildindex/grid.rjson     

GET request

Gets the list of creating grid index jobs of the current system.

Response structure  

After executing a GET request on grid resource, the response entity is a set of creating grid index resource descriptions, and the response fields of single resource are as follows:

Field Type Description
id String Application ID.
state Jobstate The status of the task. Including execution status, start time, time consuming, and so on.
setting SparkJobSetting Lists the detailed information of task configuration.

Response example

By executing a GET request on grid resource, the returned response result in rjosn format is as follows:

[{

  "id": "6acafdac_f5f3_4c76_9ae5_b5a9625e69cd",

  "state": {

    "errorStackTrace": null,

    "endState": true,

    "startTime": 1513748139147,

    "endTime": 1513748170478,

    "publisherelapsedTime": 0,

    "runState": "FINISHED",

    "errorMsg": null,

    "elapsedTime": 30318

  },

  "setting": {

    "output": {

      "outputPath": null,

      "datasourcePath": "hdfs://192.168.112.126:9000/data/test123",

      "datasetName": "analystResult",

      "type": "INDEXEDHDFS"

    },

    "args": null,

    "input": {

      "datasetName": "samples_processing_newyorkZone_R",

      "numSlices": 36,

      "specField": null,

      "datasetInfo": {

        "fieldInfos": [

          {

            "isRequired": true,

            "defaultValue": "",

            "name": "SmID",

            "caption": "SmID",

            "type": "INT32",

            "maxLength": 4,

            "isZeroLengthAllowed": true,

            "isSystemField": true

          },

          {

            "isRequired": true,

            "defaultValue": "0",

            "name": "SmSdriW",

            "caption": "SmSdriW",

            "type": "SINGLE",

            "maxLength": 4,

            "isZeroLengthAllowed": true,

            "isSystemField": true

          },

          {

            "isRequired": true,

            "defaultValue": "0",

            "name": "SmSdriN",

            "caption": "SmSdriN",

            "type": "SINGLE",

            "maxLength": 4,

            "isZeroLengthAllowed": true,

            "isSystemField": true

          },

          {

            "isRequired": true,

            "defaultValue": "0",

            "name": "SmSdriE",

            "caption": "SmSdriE",

            "type": "SINGLE",

            "maxLength": 4,

            "isZeroLengthAllowed": true,

            "isSystemField": true

          },

          {

            "isRequired": true,

            "defaultValue": "0",

            "name": "SmSdriS",

            "caption": "SmSdriS",

            "type": "SINGLE",

            "maxLength": 4,

            "isZeroLengthAllowed": true,

            "isSystemField": true

          },

          {

            "isRequired": true,

            "defaultValue": "0",

            "name": "SmUserID",

            "caption": "SmUserID",

            "type": "INT32",

            "maxLength": 4,

            "isZeroLengthAllowed": true,

            "isSystemField": false

          },

          {

            "isRequired": true,

            "defaultValue": "0",

            "name": "SmArea",

            "caption": "SmArea",

            "type": "DOUBLE",

            "maxLength": 8,

            "isZeroLengthAllowed": true,

            "isSystemField": true

          },

          {

            "isRequired": true,

            "defaultValue": "0",

            "name": "SmPerimeter",

            "caption": "SmPerimeter",

            "type": "DOUBLE",

            "maxLength": 8,

            "isZeroLengthAllowed": true,

            "isSystemField": true

          },

          {

            "isRequired": false,

            "defaultValue": "0",

            "name": "SmGeometrySize",

            "caption": "SmGeometrySize",

            "type": "INT32",

            "maxLength": 4,

            "isZeroLengthAllowed": true,

            "isSystemField": true

          },

          {

            "isRequired": true,

            "defaultValue": "-1",

            "name": "SmGeoPosition",

            "caption": "SmGeoPosition",

            "type": "INT64",

            "maxLength": 8,

            "isZeroLengthAllowed": true,

            "isSystemField": true

          },

          {

            "isRequired": false,

            "defaultValue": "",

            "name": "OBJECTID",

            "caption": "OBJECTID",

            "type": "INT32",

            "maxLength": 4,

            "isZeroLengthAllowed": true,

            "isSystemField": false

          },

          {

            "isRequired": false,

            "defaultValue": "",

            "name": "Shape_Leng",

            "caption": "Shape_Leng",

            "type": "DOUBLE",

            "maxLength": 8,

            "isZeroLengthAllowed": true,

            "isSystemField": false

          },

          {

            "isRequired": false,

            "defaultValue": "",

            "name": "Shape_Area",

            "caption": "Shape_Area",

            "type": "DOUBLE",

            "maxLength": 8,

            "isZeroLengthAllowed": true,

            "isSystemField": false

          },

          {

            "isRequired": false,

            "defaultValue": "",

            "name": "zone",

            "caption": "zone",

            "type": "WTEXT",

            "maxLength": 254,

            "isZeroLengthAllowed": true,

            "isSystemField": false

          },

          {

            "isRequired": false,

            "defaultValue": "",

            "name": "LocationID",

            "caption": "LocationID",

            "type": "INT32",

            "maxLength": 4,

            "isZeroLengthAllowed": true,

            "isSystemField": false

          },

          {

            "isRequired": false,

            "defaultValue": "",

            "name": "borough",

            "caption": "borough",

            "type": "WTEXT",

            "maxLength": 254,

            "isZeroLengthAllowed": true,

            "isSystemField": false

          }

        ],

        "epsgCode": 4326,

        "datasetName": "newyorkZone_R",

        "bounds": "Left=-74.25551784310493,Bottom=40.496084221255856,Right=-73.70014827248451,Top=40.91538866049913",

        "available": true,

        "name": "samples_processing_newyorkZone_R",

        "readOnly": false,

        "datasetType": "REGION",

        "type": "UDB",

        "url": "../../samples/data/ProcessingData/processing.udb"

      }

    },

    "DEFAULT_MASTER_ADRESS": "local[*] ",

    "referToken": "dZWm9aJqJbEYKkVEZyc8qKPdVK0oVIh9p-UzDxZTEFUH_o9rEPcqAKl7s-tfkS4euGyUAm6jUbA5S1JWpaeuiQ..",

    "mainClass": null,

    "sparkLogFile": null,

    "appName": null,

    "analyst": {

      "bounds": "-74.050,40.650,-73.850,40.850",

      "indexFile": "",

      "interval": "0",

      "isSer": true,

      "rows": "10",

      "cols": "10"

    },

    "contextSetting": null,

    "serviceInfo": {

      "targetDataPath": null,

      "targetServiceInfos": null

    },

    "referServicesAddress": "http://supermapiserver:8090/iserver"

  }

}]

POST request

Creates a data directory of hdfs with a grid spatial index.

Request parameter

Parameters passed in the request body should contain:

Name Type Description
input FileCSVInputDataSetting
DatasetInputDataSetting

[The following parameters are required if not specified] Supports two input ways, only supports point, line and polygon:

1.  datasetName: dataset name. Used when the data to be analyzed is dataset provided by the Data Catalog Service, including data imported through Data Catalog Service, registered data in iServer and datasets stored in DataStore.

 

2. Input file path and the related information. When the data to be analyzed does not belong to Data Catalog Service, you need use this method.

      

Supported file formats: csv file, udb file, pg database. For detailed parameters' description, see:Big data analysis input parameter settings.

analyst BuildGridIndexAnalystSetting [Required] Analysis settings.
  1. By configuring parameters, you need to specify:
    • bounds: Calculating extent, optional. Defaults to full extent.
    • rows: Number of rows, required.
    • cols: Number of columns, required.
    • interval: The external expansion tolerance for calculating grid partitions, optional. Default value is 0.
  1. By using existing index file, you need to spefify:
    • indexFile: index file path, required.
output FileSystemOutputSetting

[Optional] The output of analysis result. Only supports outputting to hdfs directory. Note: Only supports newly created hdfs directory, existing hdfs directories are not supported.

 

Example 1: By configuring parameters

Execute a POST request on grid resource to create a data processing job: http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/dataprocessing/buildindex/grid .rjson by configuring parameters:

{

    "input": {

        "datasetName": "samples_processing_newyorkZone_R"

    },

    "analyst": {

        "indexFile": "",

        "bounds": "-74.050,40.650,-73.850,40.850",

        "rows": "10",

        "cols": "10",

        "interval": "0"

    },

    "output": {

        "datasourcePath": "hdfs://192.168.112.126:9000/data/test1",

        "type": "INDEXEDHDFS"

    }

}

then the returned resource in rjson format is as follows:

{

  "newResourceID": "6acafdac_f5f3_4c76_9ae5_b5a9625e69cd",

  "newResourceLocation":"http://localhost:8090/iserver/services/distributedanalyst/rest/v1/jobs/dataprocessing/buildindex/grid/6acafdac_f5f3_4c76_9ae5_b5a9625e69cd",

  "postResultType": "CreateChild",

  "succeed": true

}

 

Example 2: By using existing index file

Execute a POST request on grid resource to create a data processing job: http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/dataprocessing/buildindex/grid .rjson by specifying existing index file:

{

    "input": {

        "datasetName": "samples_processing_newyorkZone_R"

    },

    "analyst": {

        "indexFile": "hdfs://192.168.112.126:9000/data/test1",

        "bounds": "-74.050,40.650,-73.850,40.850",

        "rows": "",

        "cols": "",

        "interval": ""

    },

    "output": {

        "datasourcePath": "hdfs://192.168.112.126:9000/data/test",

        "type": "INDEXEDHDFS"

    }

}

then the returned resource in rjson format is as follows:

{

  "newResourceID": "0799bf7b_6010_4c12_bbf3_647152d53e7b",

  "newResourceLocation": "http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/spatialanalyst/overlay/0799bf7b_6010_4c12_bbf3_647152d53e7b",

  "postResultType": "CreateChild",

  "succeed": true

}

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 grid resource exists, or if the user has the authority to access it. By executing an HEAD request with a .<format> URI, you can quickly determine whether the grid resource supports the <format> representation.

See