<spatialanalystJobs_uri>/summaryattributes[.<format>]
属性汇总统计分析作业资源根目录。通过对 summaryAttributes 执行GET 请求,可获取当前系统的属性汇总统计分析作业列表。通过 POST 请求可创建一个分析任务。
支持的方法:
支持的表述格式:RJSON、JSON、HTML、XML。
对如下 URI 执行 HTTP 请求,以 rjson 输出格式为例加以说明,其中,supermapiserver 是服务器名。
http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/spatialanalyst/summaryattributes.rjson
获取属性汇总统计分析作业列表。
对 summaryAttributes 资源执行 GET 请求,在响应消息的实体主体里是一个属性汇总统计分析资源描述集,其中单个资源描述的结构如下:
字段 | 类型 | 说明 |
id | String | 应用ID。 |
state | SparkJobState | 该任务的状态。包括执行状态、起止时间、耗时等。 |
setting | SparkJobSetting | 列举了任务配置的详细信息。 |
对 summaryAttributes 资源执行 GET 请求,返回 rjson 格式的资源描述如下:
{
"id": "b999e6ba_61c7_4c29_9009_5d876469db33",
"setting": {
"DEFAULT_MASTER_ADRESS": "local[*] ",
"analyst": {
"attributeField": "",
"groupField": "",
"resultField": null,
"statisticModes": ""
},
"appName": "SummaryAttributes",
"args": [
"--input",
"{\"sliceNum\":20,\"type\":\"udb\",\"info\":[{\"server\":\"F:\\\\1.package\\\\20171014\\\\supermap_iserver_901_15413_4668_win64_zip\\\\samples\\\\data\\\\ProcessingData\\\\processing.udb\",\"datasetNames\":[\"newyorkZone_R\"]}]}",
"--output",
"{\"server\":\"192.168.120.21\",\"password\":\"supermap\",\"database\":\"supermap2\",\"datasetName\":\"analystResult_1698682527\",\"blockingWrite\":null,\"type\":\"pg\",\"user\":\"postgres\"}"
],
"contextSetting": null,
"input": {
"datasetInfo": {
"available": true,
"bounds": "Left=-74.25551784310493,Bottom=40.496084221255856,Right=-73.70014827248451,Top=40.91538866049913",
"datasetName": "newyorkZone_R",
"datasetType": "REGION",
"epsgCode": 4326,
"name": "samples_processing_newyorkZone_R",
"readOnly": false,
"type": "UDB",
"url": "../../samples/data/ProcessingData/processing.udb"
},
"datasetName": "samples_processing_newyorkZone_R",
"numSlices": 0
},
"mainClass": "com.supermap.bdt.main.SummaryAttributesMain",
"output": {
"datasetName": "analystResult_1698682527",
"datasourceInfo": {
"alias": "supermap2_pg",
"connect": true,
"dataBase": "supermap2",
"driver": "PostgreSQL ANSI",
"engineType": "POSTGRESQL",
"exclusive": false,
"openLinkTable": false,
"password": "supermap",
"readOnly": false,
"server": "192.168.120.21",
"user": "postgres"
},
"outputPath": "F:\\1.package\\20171014\\supermap_iserver_901_15413_4668_win64_zip\\webapps\\iserver\\processingResultData\\Analyst\\b999e6ba_61c7_4c29_9009_5d876469db33\\summaryAttributes.smwu",
"type": "pg"
},
"serviceInfo": {
"targetDataPath": "F:\\1.package\\20171014\\supermap_iserver_901_15413_4668_win64_zip\\webapps\\iserver\\processingResultData\\Analyst\\b999e6ba_61c7_4c29_9009_5d876469db33\\summaryAttributes.smwu",
"targetServiceInfos": [{
"serviceAddress": "http://192.168.120.21:8090/iserver/services/data-summaryAttributes/rest",
"serviceType": "RESTDATA"
}]
},
"serviceRoot": "http://supermapiserver:8090/iserver/services/",
"sparkLogFile": null
},
"state": {
"elapsedTime": 6177,
"endState": true,
"endTime": 1508224183579,
"errorMsg": null,
"errorStackTrace": null,
"publisherelapsedTime": 1823,
"runState": "FINISHED",
"startTime": 1508224172840
}
}
创建一个属性汇总统计分析任务。
对 summaryAttributes 资源执行 POST 请求,创建一个属性汇总统计分析任务,请求体需包含参数如下:
名称 | 类型 | 含义 |
input 【必填参数】 |
DatasetInputDataSetting |
|
FileCSVInputDataSetting |
|
|
analyst |
SummaryAttributesAnalystSetting | 【非必填参数】分析配置。传入时,需指定:
|
output 【选填参数】 |
FileSystemOutputSetting |
|
DatabaseOutputSetting |
|
对示例 summaryAttributes 资源:http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/spatialanalyst/summaryattributes.rjson 执行 POST请求,输入一个已注册到iServer的数据集,传入数据集名称即可。创建一个属性汇总统计分析任务。请求体如下:
{
"input": {
"datasetName": "samples_processing_newyorkZone_R"
},
"analyst": {
"groupField": "borough",
"attributeField": "LocationID",
"statisticModes": "max"
}
}
返回 rjson 格式的操作结果表述如下:
{
"newResourceID": "740e3864_4698_4cf2_aa2a_3e25282bcac7",
"newResourceLocation":"http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/spatialanalyst/summaryattributes/740e3864_4698_4cf2_aa2a_3e25282bcac7",
"postResultType": "CreateChild",
"succeed": true
}
对示例 query 资源:http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/spatialanalyst/summaryattributes.rjson 执行 POST 请求,输入数据为存储于PostgreSQL 数据库的数据。创建一个属性汇总统计任务,请求体中的参数如下:
{
"input": {
"datasetInfo": {
"type": "REGION",
"name": "newyorkZone_R_657101200",
"datasourceConnectionInfo": {
"engineType": "POSTGRESQL",
"dataBase": "supermap",
"password": "supermap",
"user": "postgres",
"server": "192.168.120.21"
}
}
},
"analyst": {
"groupField": "borough",
"attributeField": "LocationID",
"statisticModes": "min"
}
}
返回 rjson 格式的操作结果表述如下:
{
"newResourceID": "6bb40d00_e89b_493d_b787_e0e82fd4fc57",
"newResourceLocation": "http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/spatialanalyst/summaryattributes/6bb40d00_e89b_493d_b787_e0e82fd4fc57",
"postResultType": "CreateChild",
"succeed": true
}
返回跟 GET 请求一样的 HTTP 响应头,但是没有响应实体。可以在不必传输整个响应内容的情况下,获取包含在响应消息头中的元数据信息。元数据信息包括媒体类型,字符编码,压缩编码,实体内容长度等。
HEAD 请求可以用来判断 summaryAttributes 资源是否存在,或者客户端是否有权限访问 summaryAttributes 资源。通过对加.<format>的 URI 执行 HEAD 请求,还可以快速判断 summaryAttributes 资源是否支持<format>格式的表述。