buildRegionGrid


URI

<dataprocessingJobs_uri>/buildregiongrid[.<format>]

支持的方法

GETPOSTHEAD

父资源

dataProcessingJobs

子资源

buildRegionGridJob

介绍

构造区域格网资源根目录。通过对 buildRegionGrid  执行GET 请求,可获取当前系统的构造区域格网作业列表。通过 POST 请求可创建一个分析任务。

支持的方法:

支持的表述格式:RJSON、JSON、HTML、XML。

资源层次

HTTP 请求方法

对如下 URI 执行 HTTP 请求,以 rjson 输出格式为例加以说明,其中,supermapiserver 是服务器名。

http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/dataprocessing/buildregiongrid.rjson

GET 请求

获取构造区域格网作业列表。

响应结构

对 buildRegionGrid 资源执行 GET 请求,在响应消息的实体主体里是一个构造区域格网资源描述集,其中单个资源描述的结构如下:

字段 类型 说明
id String 应用ID。
state SparkJobState 该任务的状态。包括执行状态、起止时间、耗时等。
setting SparkJobSetting 列举了任务配置的详细信息。

响应示例

对 buildRegionGrid 资源执行 GET 请求,返回 rjson 格式的资源描述如下:

[

    {

        "id": "677c4aaf_cd4b_4837_ab0f_7bc4e2a0f08b",

        "state": {

            "errorStackTrace": null,

            "endState": true,

            "startTime": 1539237320440,

            "endTime": 1539237353946,

            "publisherelapsedTime": 2491,

            "runState": "FINISHED",

            "errorMsg": null,

            "elapsedTime": 30437

        },

        "setting": {

            "output": {

                "outputPath": "F:\\01_package\\20181010\\supermap_iserver_910_16609_3565_win64_deploy\\webapps\\iserver\\processingResultData\\Analyst\\677c4aaf_cd4b_4837_ab0f_7bc4e2a0f08b\\buildregiongrid.smwu",

                "datasourcePath": "F:\\01_package\\20181010\\supermap_iserver_910_16609_3565_win64_deploy\\webapps\\iserver\\processingResultData\\Analyst\\677c4aaf_cd4b_4837_ab0f_7bc4e2a0f08b\\340c2810_4c9f_4052_b7f8_ab4af53cb1b7.udb",

                "datasetName": "analystResult",

                "type": "UDB"

            },

            "args": null,

            "input": {

                "datasetName": "samples_processing_singleRegion_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

                        }

                    ],

                    "epsgCode": 4326,

                    "datasetName": "singleRegion_R",

                    "bounds": "Left=-74.0012189965531,Bottom=40.691422739248694,Right=-73.84588071508979,Top=40.84578668020041",

                    "available": true,

                    "name": "samples_processing_singleRegion_R",

                    "readOnly": false,

                    "datasetType": "REGION",

                    "type": "UDB",

                    "url": "F:\\01_package\\ProcessingData\\processing.udb"

                }

            },

            "DEFAULT_MASTER_ADRESS": "local[*] ",

            "referToken": "d4MIZB1FF6IKu3eUH5IYpabwyLcLYeBEDee9yn-O5WyQo5lyLNArFQHdzNrlTNYWTGm-n6yvG04qkwpnFer6ZA..",

            "mainClass": null,

            "sparkLogFile": null,

            "appName": null,

            "analyst": {

                "distanceUnit": "Meter",

                "datasetPoint": "samples_processing_newyorkPoint_P",

                "IDField": "passenger_count",

                "inputPointData": "{\"type\":\"udb\",\"info\":[{\"server\":\"F:\\\\01_package\\\\ProcessingData\\\\processing.udb\",\"datasetNames\":[\"newyorkPoint_P\"]}]}",

                "width": 100,

                "summaryFields": [

                    "passenger_count"

                ],

                "statisticsSameID": false,

                "height": 100,

                "summaryStatisticModes": [

                    "MIN"

                ]

            },

            "contextSetting": null,

            "serviceInfo": {

                "targetDataPath": "F:\\01_package\\20181010\\supermap_iserver_910_16609_3565_win64_deploy\\webapps\\iserver\\processingResultData\\Analyst\\677c4aaf_cd4b_4837_ab0f_7bc4e2a0f08b\\buildregiongrid.smwu",

                "targetServiceInfos": [

                    {

                        "serviceType": "RESTDATA",

                        "serviceAddress": "http://192.168.120.21:8090/iserver/services/data-buildregiongrid16/rest"

                    },

                    {

                        "serviceType": "RESTMAP",

                        "serviceAddress": "http://192.168.120.21:8090/iserver/services/map-buildregiongrid16/rest"

                    }

                ]

            },

            "referServicesAddress": "http://192.168.120.21:8090/iserver"

        }

    }

]

POST 请求

创建一个构造区域格网任务

请求参数

对 buildRegionGrid 资源执行 POST 请求,创建一个构造区域格网任务,请求体需包含参数如下:

名称 类型 含义

input

【必填参数】

DatasetInputDataSetting
  • 数据集输入设置,当输入数据是一个数据目录服务中已存在的数据集时,用该设置。其中包含如下字段
    • datasetName:区域面数据集名称(仅支持一个面对象数据集)。其中数据集的来源包括通过数据目录服务导入的数据、注册到 iServer 的数据对应的数据集以及 DataStore 中存储的数据集。
  • 数据集信息输入设置,当输入数据集文件路径及信息时,用该设置。其中包含如下字段
    • datasetInfo:区域面数据集名称(仅支持一个面对象数据集)。其中数据集的来源包括:udb文件、空间数据库。详细参数说明请参考:大数据分析输入参数设定

analyst

BuildRegionGridSetting 【以下不做特殊说明的均为必填参数】分析配置。传入时,需指定:
  • height:生成格网的高度。
  • width:生成格网的宽度。
  • distanceUnit:格网高度和宽度的单位。 可选值:Meter、Kilometer、 Yard、 Foot、 Mile。默认值:Meter 。【选填参数】
  • datasetPoint:统计点数据集。该数据集可以为空。【选填参数】
  • IDField:统计点ID字段。该字段用来区别不同行的统计对象。仅支持系统字段以外的整形、长整形、浮点型的字段的名称。【选填参数】
  • summaryFields:统计字段名称。仅支持系统字段以外的整形、长整形、浮点型的字段的名称。统计字段的个数应和统计模式的个数保持一致。【选填参数】
  • summaryStatisticModes:统计模式。支持统计模式有MAX,MIN,SUM,RECORDCOUNT,AVERAGE,VARIANCE,STDDEVIATION。【选填参数】
  • statisticsSameID:是否统计ID相同数据。默认值为false。【选填参数】

output

【选填参数】

FileSystemOutputSetting
  • 分析结果输出设置。当输出结果到文件时。用该设置。其中包含如下字段
    • type:指定输出类型。
    • datasourcePath :结果数据源的存放路径。其中分析结果可以存放到udb或hdfs中。
    • outputPath:分析结果工作空间输出路径。
DatabaseOutputSetting
  • 分析结果输出设置。当输出结果到数据库(PostgreSQL、PostGIS、MongoDB)时。用该设置。其中包含如下字段
    • type:指定输出类型。
    • datasetName:分析结果数据集名称。
    • datasourceInfo:结果数据源的连接信息。详细参数设定请参考:大数据分析输出参数设定

示例1:输入数据集名称

对示例 buildRegionGrid 资源:http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/dataprocessing/buildregiongrid.json 输入形式为数据集名称,该数据集已注册到iServer。执行POST 请求,创建一个构造区域格网任务。请求体中的参数如下:

{

    "input": {

        "datasetName": "samples_processing_singleRegion_R"

    },

    "analyst": {

        "height": "100",

        "width": "100",

        "distanceUnit": "Meter",

        "datasetPoint": "samples_processing_newyorkPoint_P",

        "IDField": "passenger_count",

        "summaryFields": [

            "passenger_count"

        ],

        "summaryStatisticModes": [

            "MIN"

        ],

        "statisticsSameID": false

    }

}

返回 rjson 格式的操作结果表述如下:

{

    "postResultType": "CreateChild",

    "newResourceID": "677c4aaf_cd4b_4837_ab0f_7bc4e2a0f08b",

    "succeed": true,

    "newResourceLocation": "http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/dataprocessing/buildregiongrid/677c4aaf_cd4b_4837_ab0f_7bc4e2a0f08b"

}

示例2:输出结果存到PostGIS中

对示例 buildRegionGrid 资源:http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/dataprocessing/buildregiongrid.json 执行POST 请求,创建一个构造区域格网任务,使输出结果存到PostGIS中。请求体中的参数如下:

{

    "input": {

        "datasetName": "samples_processing_singleRegion_R"

    },

    "analyst": {

        "height": "100",

        "Width": "100",

        "distanceUnit": "Meter",

        "datasetPoint": "samples_processing_newyorkPoint_P",

        "IDField": "passenger_count",

        "summaryFields": [

            "passenger_count"

        ],

        "summaryStatisticModes": [

            "MIN"

        ],

        "statisticsSameID": false

    },

    "output": {

        "type": "POSTGIS",

        "datasetName": "analystResult1",

        "datasourceInfo": {

            "server": "192.168.120.21",

            "dataBase": "iserver070",

            "engineType": "POSTGIS",

            "user": "postgres",

            "password": "postgres"

        }

    }

}

返回 rjson 格式的操作结果表述如下:

{

    "postResultType": "CreateChild",

    "newResourceID": "ce4e4fdf_ad8b_4afa_8d79_34142b01f2cc",

    "succeed": true,

    "newResourceLocation": "http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/dataprocessing/buildregiongrid/ce4e4fdf_ad8b_4afa_8d79_34142b01f2cc"

}

示例3:输入数据集文件路径及信息

对示例 buildRegionGrid 资源:http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/dataprocessing/buildregiongrid.json 输入形式为数据集文件路径及信息,该数据集未注册到iServer中,执行POST 请求,创建一个构造区域格网任务。请求体中的参数如下:

{

    "input": {

        "datasetInfo": {

            "type": "REGION",

            "name": "singleRegion_R",

            "datasourceConnectionInfo": {

                "engineType": "POSTGIS",

                "dataBase": "iserver070",

                "password": "supermap",

                "user": "postgres",

                "server": "192.168.120.21"

            }

        }

    },

    "analyst": {

        "height": "100",

        "Width": "100",

        "distanceUnit": "Meter",

        "datasetPoint": "samples_processing_newyorkPoint_P",

        "IDField": "passenger_count",

        "summaryFields": [

            "passenger_count"

        ],

        "summaryStatisticModes": [

            "MIN"

        ],

        "statisticsSameID": false

    }

}

返回 rjson 格式的操作结果表述如下:

{

    "postResultType": "CreateChild",

    "newResourceID": "9077b74d_8816_4c57_b490_38e1393a5cc0",

    "succeed": true,

    "newResourceLocation": "http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/dataprocessing/buildregiongrid/9077b74d_8816_4c57_b490_38e1393a5cc0"

}

HEAD 请求

返回跟 GET 请求一样的 HTTP 响应头,但是没有响应实体。可以在不必传输整个响应内容的情况下,获取包含在响应消息头中的元数据信息。元数据信息包括媒体类型,字符编码,压缩编码,实体内容长度等。

HEAD 请求可以用来判断 buildRegionGrid 资源是否存在,或者客户端是否有权限访问 buildRegionGrid 资源。通过对加.<format>的 URI 执行 HEAD 请求,还可以快速判断 buildRegionGrid 资源是否支持<format>格式的表述。

请参见