density


URI

<spatialanalystJobs_uri>/density[.<format>]

Supported methods

GET, POST, HEAD

Parent resource

spatialanalystJobs

Child resources

densityJob

Introduction

The root directory of the density analysis job resource. By sending a GET request to density, you can get the list of the density analysis 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/spatialanalyst/density.rjson

GET request

Gets the list of density analysis jobs.

Response structure

After executing a GET request on the resource, the response entity is a set of density 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 this resource, the returned response result in rjosn format is as follows:

[

{

  "id": "546fdbc5_81c3_49a8_8341_1f2fd696da8f",

  "setting": {

    "DEFAULT_MASTER_ADRESS": "local[*] ",

    "analyst": {

      "fields": "",

      "meshType": "0",

      "method": "0",

      "query": "",

      "radius": "0.01",

      "resolution": "0.001"

    },

    "appName": "density",

    "args": [

      "--input",

      "{\"sliceNum\":20,\"type\":\"udb\",\"info\":[{\"server\":\"F:\\\\20170707\\\\China\\\\China.udb\",\"datasetNames\":[\"China_Capital_pt\"]}]}",

      "--radius",

      "0.01",

      "--method",

      "uniform",

      "--meshType",

      "square",

      "--meshSize",

      "0.001",

      "--output",

      "{\"server\":\"F:\\\\20170707\\\\supermap_iserver_win64_zip\\\\webapps\\\\iserver\\\\processingResultData\\\\Analyst\\\\udbs\\\\4ab58165-a839-4c80-b8b2-1a2d98ad465b\",\"datasetName\":\"analystResult\",\"type\":\"udb\"}"

    ],

    "contextSetting": null,

    "input": {

      "datasetInfo": {

        "available": true,

        "bounds": "Left=1.2957801616844445E7,Bottom=4852151.575504352,Right=1.2957801616844445E7,Top=4852151.575504352",

        "datasetName": "China_Capital_pt",

        "datasetType": "POINT",

        "epsgCode": 3857,

        "name": "China_China_China_Capital_pt",

        "readOnly": false,

        "type": "UDB",

        "url": "F:\\20170707\\China\\China.udb"

      },

      "datasetName": "China_China_China_Capital_pt",

      "numSlices": 0

    },

    "mainClass": "com.supermap.bsp.main.DensityAnalystMain",

    "output": {

      "datasetName": "analystResult",

      "outputPath": "F:\\20170707\\supermap_iserver_win64_zip\\webapps\\iserver\\processingResultData\\Analyst\\udbs\\4ab58165-a839-4c80-b8b2-1a2d98ad465b"

    },

    "serviceInfo": {

      "targetDataPath": "F:\\20170707\\supermap_iserver_win64_zip\\webapps\\iserver\\processingResultData\\Analyst\\546fdbc5_81c3_49a8_8341_1f2fd696da8f",

      "targetServiceInfos": [

        {

          "path": "http://supermapiserver:8090/iserver/services/distributedanalyst/rest/jobs/spatialanalyst",

          "serviceType": "RESTMAP"

        },

        {

          "serviceAddress": "http://supermapiserver:8090/iserver/services/data-kernelDensity8/rest",

          "serviceType": "RESTDATA"

        }

      ]

    },

    "serviceRoot": "http://supermapiserver:8090/iserver/services/"

  },

  "state": {

    "elapsedTime": 6096,

    "endState": true,

    "endTime": 1499417671510,

    "errorMsg": null,

    "errorStackTrace": null,

    "publisherelapsedTime": 1702,

    "runState": "FINISHED",

    "startTime": 1499417662453

  }

}

]

POST request

Creates a kernel density analysis job.

Request parameter

Parameters passed in the request body should contain:

Name Type Description
input FileCSVInputDataSetting
DatasetInputDataSetting
 

[Required] Supports two input ways:

1.  datasetName: dataset name. Used when the data to be analyzed is point dataset provided by the Data Catalog Service, including data imported through Data Catalog Service, registered data in iServer and point 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 KernelDensityAnalystSetting [Required] Analysis settings. You need to specify:
  • resolution: the grid size
  • radius: the query radius
  • method: Used to specify analysis method. 0 means simple point density analysis, 1 represents kernel density analysis
  • meshType: the mesh type. 0 denotes a quadrilateral mesh, and 1 denotes a hexagonal grid
  • fields: dataset fields of weights, optional. Only supports non-system field whose type is integer, long integer or float.
  • meshSizeUnit: grid size uint
  • radiusUnit: search radius unit
  • areaUnit: area unit
output FileSystemOutputSetting DatabaseOutputSetting

[Optional] The output of analysis result. Supported output formats: local udb file, database (pg, mongodb). For detailed parameter settings, see: Big data analysis input parameter settings.

Example 1: Input csv file

Execute a POST request on density resource to create a point density  analysis job: http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/spatialanalyst/density .rjson with the following request body which inputs registered udb file name:

{

"input": {

      "datasetName":"China_China_China_Capital_pt"

             },

"analyst":  {

        "query": "",

        "resolution": "10"

        "radius": "100",

        "method": "0",

        "meshType": "0",

        "fields": "",

        "meshSizeUnit": "Meter",

        "radiusUnit": "Meter",

        "areaUnit": "SquareMeter"

                  }

}

then the returned resource in rjson format is as follows:

{

  "newResourceID": "8bf67620_2c3a_4752_8cce_30076f3fe94e",

  "newResourceLocation":"http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/spatialanalyst/density/8bf67620_2c3a_4752_8cce_30076f3fe94e",

  "postResultType": "CreateChild",

  "succeed": true

}

Example 2: Input dataset file

Execute a POST request on density resource to create a density analysis job: http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/spatialanalyst/density .rjson with the following request body which specifies a local udb file:

{

    "input": {

        "datasetInfo": {

            "type": "UDB",

            "url": "F:\\20170707\\China\\China.udb"

            "datasetType": "POINT",

            "datasetName": "China_Capital_pt",

        },

       "numSlices": 36

    },

    "analyst": {

         "query": "",

        "resolution": "10"

        "radius": "100",

        "method": "0",

        "meshType": "0",

        "fields": "",

    }

}

then the returned resource in rjson format is as follows:

{

  "newResourceID": "015fb79a_0f32_49d1_a0a9_743c10052156",

  "newResourceLocation":"http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/spatialanalyst/density/015fb79a_0f32_49d1_a0a9_743c10052156",

  "postResultType": "CreateChild",

  "succeed": true

}

Example 3: Input data stored in PostgreSQL

Execute a POST request on density resource to create a density  analysis job: http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/spatialanalyst/density .rjson with the following request body which specifies idata stored in PostgreSQL as the input data:

{

    "input": {

        "datasetInfo": {

            "type": "POINT",

            "name": "newyorkPoint_P_1359289148",

            "datasourceConnectionInfo": {

                "engineType": "POSTGRESQL",

                "dataBase": "supermap",

                "password": "iserver",

                "user": "postgres",

                "server": "192.168.120.49"

            }

        }

    },

"analyst": {

     "radius": "350",

     "method":"0",

     "meshType":"0",

     "resolution": "50"

     "meshSizeUnit": "Meter",

     "radiusUnit": "Meter",

     "areaUnit":"SquareMile",

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

  }

}

then the returned resource in rjson format is as follows:

{

  "newResourceID": "0c0ef6fd_7efa_4bfe_a652_17fa2ea7e676",

  "newResourceLocation": "http://localhost:8090/iserver/services/distributedanalyst/rest/v1/jobs/spatialanalyst/vectorclip/0c0ef6fd_7efa_4bfe_a652_17fa2ea7e676",

  "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 density 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 density resource supports the <format> representation.

See