<buildindex_uri>/grid[.<format>]
创建格网索引作业资源目录。通过对 grid 执行GET 请求,可获取当前系统的创建格网索引作业列表。通过 POST 请求可创建一个分析任务。
支持的方法:
支持的表述格式:RJSON、JSON、HTML、XML。
对如下 URI 执行 HTTP 请求,以 rjson 输出格式为例加以说明,其中,supermapiserver 是服务器名。
http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/dataprocessing/buildindex/grid.rjson
获取当前系统的创建格网索引作业列表
对 grid 资源执行 GET 请求,在响应消息的实体主体里是一个格网索引资源描述集,其中单个资源描述的结构如下:
名称 | 类型 | 含义 |
id | String | 应用ID。 |
state | SparkJobState | 该任务的状态。包括执行状态、起止时间、耗时等。 |
setting | SparkJobSetting | 列举了任务配置的详细信息。 |
对 grid 资源执行 GET 请求,返回 rjson 格式的资源描述如下:
[{
"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"
}
}]
创建一个带格网空间索引的hdfs的数据目录。
对grid 资源执行 POST 请求,创建一个 数据处理作业任务,请求体需包含参数如下:
名称 | 类型 | 含义 |
input 【必填参数】 |
DatasetInputDataSetting |
|
FileCSVInputDataSetting |
|
|
analyst |
BuildGridIndexAnalystSetting | 【必填参数】分析配置。传入时,需指定:
|
output |
FileSystemOutputSetting | 【选填参数】分析结果的输出。只支持输出到hdfs目录。(注:仅支持新创建的hdfs目录,已存在暂不支持。且该目录必须允许其他用户写入,建议将该hdfs目录的权限设置为777。) |
对示例 grid 资源:http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/dataprocessing/buildindex/grid .rjson 通过配置参数的形式,执行POST 请求,创建一个数据处理作任务。请求体中的参数如下:
{
"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"
}
}
返回 rjson 格式的操作结果表述如下:
{
"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
}
对示例 grid 资源:http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/dataprocessing/buildindex/grid .rjson 通过已有的索引文件的形式,执行POST 请求,创建一个数据处理作任务。请求体中的参数如下:
{
"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"
}
}
返回 rjson 格式的操作结果表述如下:
{
"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
返回跟 GET 请求一样的 HTTP 响应头,但是没有响应实体。可以在不必传输整个响应内容的情况下,获取包含在响应消息头中的元数据信息。元数据信息包括媒体类型,字符编码,压缩编码,实体内容长度等。
HEAD 请求可以用来判断 grid 资源是否存在,或者客户端是否有权限访问 grid 资源。通过对加.<format>的 URI 执行 HEAD 请求,还可以快速判断 grid 资源是否支持<format>格式的表述。