calculateODMatrix


URI

<spatialanalystJobs_uri>/calculateodmatrix[.<format>]

支持的方法

GETPOSTHEAD

父资源

spatialanalystJobs

子资源

calculateODMatrixJob

介绍

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

支持的方法:

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

资源层次

 

HTTP 请求方法

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

http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/spatialanalyst/calculateodmatrix.rjson

GET 请求

获取OD分析的作业列表。

响应结构

对 calculateODMatrix 资源执行 GET 请求,在响应消息的实体主体里是一个OD分析资源描述集,其中单个资源描述的结构如下:

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

响应示例

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

[

    {

        "id": "082c713b_c1b2_4b51_852d_96607b6426de",

        "state": {

            "errorStackTrace": null,

            "endState": true,

            "startTime": 1531210323465,

            "endTime": 1531210382337,

            "publisherelapsedTime": 3664,

            "runState": "FINISHED",

            "errorMsg": null,

            "elapsedTime": 52694

        },

        "setting": {

            "output": {

                "outputPath": "F:\\01_package\\20180710\\supermap_iserver_910_16309_3357_win64_deploy\\webapps\\iserver\\processingResultData\\Analyst\\082c713b_c1b2_4b51_852d_96607b6426de\\calculateodmatrix.smwu",

                "datasourcePath": "F:\\01_package\\20180710\\supermap_iserver_910_16309_3357_win64_deploy\\webapps\\iserver\\processingResultData\\Analyst\\082c713b_c1b2_4b51_852d_96607b6426de\\c99222f3_0dbe_4c89_a0ee_ba9d8aa26bf7.udb",

                "datasetName": "analystResult",

                "type": "UDB"

            },

            "args": null,

            "input": {

                "datasetName": "jasdjknasfa_airport_world_airport_10",

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

                            "caption": "BufferRadiusLeft",

                            "type": "DOUBLE",

                            "maxLength": 8,

                            "isZeroLengthAllowed": true,

                            "isSystemField": false

                        },

                        {

                            "isRequired": false,

                            "defaultValue": "",

                            "name": "ISO_CC",

                            "caption": "ISO_CC",

                            "type": "WTEXT",

                            "maxLength": 4,

                            "isZeroLengthAllowed": true,

                            "isSystemField": false

                        },

                        {

                            "isRequired": false,

                            "defaultValue": "",

                            "name": "NAME",

                            "caption": "NAME",

                            "type": "WTEXT",

                            "maxLength": 100,

                            "isZeroLengthAllowed": true,

                            "isSystemField": false

                        },

                        {

                            "isRequired": false,

                            "defaultValue": "",

                            "name": "ICAO",

                            "caption": "ICAO",

                            "type": "WTEXT",

                            "maxLength": 15,

                            "isZeroLengthAllowed": true,

                            "isSystemField": false

                        },

                        {

                            "isRequired": false,

                            "defaultValue": "",

                            "name": "IATA",

                            "caption": "IATA",

                            "type": "WTEXT",

                            "maxLength": 15,

                            "isZeroLengthAllowed": true,

                            "isSystemField": false

                        }

                    ],

                    "epsgCode": 4326,

                    "datasetName": "world_airport_10",

                    "bounds": "Left=-177.4824915999242,Bottom=-54.93310798762423,Right=178.65367521567165,Top=78.33567866386099",

                    "available": true,

                    "name": "jasdjknasfa_airport_world_airport_10",

                    "readOnly": false,

                    "datasetType": "REGION",

                    "type": "UDB",

                    "url": "F:\\02_Data\\ODLineabcdefghij\\airport.udb"

                }

            },

            "DEFAULT_MASTER_ADRESS": "local[*] ",

            "referToken": "nWERkior5IQsS1tPlYHbw2rNOgDkYRSmMz0UowQFjG_1RKheUV6bXmpieWe9bPDy23mGKElIZB9HVFBN7YwH6w..",

            "mainClass": null,

            "sparkLogFile": null,

            "appName": null,

            "analyst": {

                "regionNameField": "NAME",

                "coordinateFields": [

                    "x_s",

                    "y_s",

                    "x_e",

                    "y_e"

                ],

                "datasetOD": "jasdjknasfa_airport_flight100m_OD22",

                "inputOD": "{\"type\":\"udb\",\"info\":[{\"server\":\"F:\\\\02_Data\\\\ODLineabcdefghij\\\\airport.udb\",\"datasetNames\":[\"flight100m_OD22\"]}]}",

                "summaryFields": null,

                "summaryStatisticModes": null

            },

            "contextSetting": null,

            "serviceInfo": {

                "targetDataPath": "F:\\01_package\\20180710\\supermap_iserver_910_16309_3357_win64_deploy\\webapps\\iserver\\processingResultData\\Analyst\\082c713b_c1b2_4b51_852d_96607b6426de\\calculateodmatrix.smwu",

                "targetServiceInfos": [

                    {

                        "serviceType": "RESTMAP",

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

                    },

                    {

                        "serviceType": "RESTDATA",

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

                    }

                ]

            },

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

        }

    }

]

POST 请求

创建一个OD分析任务。

请求参数

对 calculateODMatrix 资源执行 POST 请求,创建一个OD分析作业任务,请求体需包含参数如下:

名称 类型 含义

input

【必填参数】

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

analyst

CalculateODMatrixAnalystSetting 【以下不做特殊说明的均为必填参数】分析配置。传入时,需指定:
  • datasetOD:OD表数据集。(仅支持属性表类型)
  • regionNameField:行政区名称字段 。该字段用来区别不同行政区面
  • coordinateFields:坐标字段数组,该字段用来定义起始点和终止点坐标,顺序为起始点X字段、起始点Y字段、终止点X字段、终止点Y字段 ,中间用逗号隔开。
  • summaryFields:属性坐标字段。统计字段个数应该和统计模式的个数保持一致。 仅支持系统字段以外的整形、长整形、浮点型的字段的名称。【选填参数】
  • summaryStatisticModes:属性统计模式。支持统计类型有MAX,MIN,SUM,RECORDCOUNT,AVERAGE,VARIANCE,STDDEVIATION。【选填参数】

output

【选填参数】

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

示例1:输入数据集名称

对示例 calculateODMatrix 资源:http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/spatialanalyst/calculateodmatrix.rjson 以输入形式为数据集名称,该数据集已注册到iServer。方式执行POST 请求,创建一个OD分析任务。请求体中的参数如下:

{

    "input": {

        "datasetName": "jasdjknasfa_airport_world_airport_10"

    },

    "analyst": {

        "datasetOD": "jasdjknasfa_airport_flight100m_OD22",

        "regionNameField": "NAME",

        "coordinateFields": [

            "x_s",

            "y_s",

            "x_e",

            "y_e"

        ]

    }

}

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

{

    "postResultType": "CreateChild",

    "newResourceID": "c9bc01b9_7a67_4906_8cb3_18846377fa71",

    "succeed": true,

    "newResourceLocation": "http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/spatialanalyst/calculateodmatrix/c9bc01b9_7a67_4906_8cb3_18846377fa71"

}

 

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

对示例 calculateODMatrix 资源:http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/spatialanalyst/calculateodmatrix.rjson执行POST 请求,创建一个OD分析任务,使输出结果存到mongodb中。请求体中的参数如下:

{

    "input": {

        "datasetName": "jasdjknasfa_airport_world_airport_10"

    },

    "analyst": {

        "datasetOD": "jasdjknasfa_airport_flight100m_OD22",

        "regionNameField": "NAME",

        "coordinateFields": [

            "x_s",

            "y_s",

            "x_e",

            "y_e"

        ]

    },

    "output": {

        "type": "mongodb",

        "datasetName": "analystResult154693",

        "datasourceInfo": {

            "server": "mongodb://192.168.120.21:27017/",

            "dataBase": "Overlaybase",

            "engineType": "MONGODB",

            "alias": "OverlayTest"

        }

    }

}

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

{

    "postResultType": "CreateChild",

    "newResourceID": "2804f2ca_b336_4452_b01a_5cec4827bf1a",

    "succeed": true,

    "newResourceLocation": "http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/spatialanalyst/calculateodmatrix/2804f2ca_b336_4452_b01a_5cec4827bf1a"

}

HEAD 请求

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

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

请参见