iShare 技术 基于ArcGIS REST API实现客户端(Flex)API -- GP服务 20110708 Sun

7
GP REST API http://<catalog-url> /<serviceName>/GPServer Task http://<gpservice-url> /<taskName> Execute Task(Synchronous) http://<task-url> /execute 执执执执执执, 执 , 执执执执执执执执执执执执 Parameters Parameter Details f Description: The response format. The default response format is html. Values: html | json | kmz <gpParameter1> , <gpParameter2> , ... Description: The various input parameters accepted by the corresponding GP task. These parameters are listed in the parameters property of the JSON representation associated with the GP task resource . The valid values for the input parameters are dependent on the data type of the parameter. These values are discussed in more detail in

description

基于ArcGIS REST API实现客户端(Flex)API -- GP服务

Transcript of iShare 技术 基于ArcGIS REST API实现客户端(Flex)API -- GP服务 20110708 Sun

GP REST API

http://<catalog-url>/<serviceName>/GPServer

Task

http://<gpservice-url>/<taskName>

Execute Task(Synchronous)

http://<task-url>/execute

执行同步任务, 发送请求后会一直处于等待状态, 直到任务执行完毕返回结果

Parameters

Parameter Details

f Description: The response format. The default response format is html.

Values: html | json | kmz

<gpParameter1>, <gpParameter2>, ...

Description: The various input parameters accepted by the corresponding GP task. These parameters are listed in the parameters property of the JSON representation associated with the GP task resource.

The valid values for the input parameters are dependent on the data type of the parameter. These values are discussed in more detail in submit job operation.

Example

http://a.com/ArcGIS/rest/services

/ESRI_Currents_World/GPServer/MessageInABottle/execute?Input_Point={"features":[{"geometry":{"x":0,"y":0}}]}&f=json

{ "results" : [{ "paramName" : "Output_String", "dataType" : "GPString", "value" : "Test String" }, { "paramName" : "Output_Double", "dataType" : "GPDouble", "value" : 545.64 }], "messages" : [{ "type" : "esriJobMessageTypeInformative", "description" : "Executing" }, { "type" : "esriJobMessageTypeInformative", "description" : "Start Time" }]}

Submit Job(Asynchronous)

http://<task-url>/submitJob

提交任务工单 -> 持续检测工单是否执行完毕 -> 取出 Task 的执行结果

Parameters

和 Execute Task 的参数一样

Example

http://a.com/ArcGIS/rest/services/ /ESRI_CadastralData_Portland/GPServer/MailingList/submitJob?Parcel_ID= 1N1E34CC&f=json

Sun, 07/08/11,
GP服务的名称
Sun, 07/08/11,
输出值
Sun, 07/08/11,
输出的数据类型
Sun, 07/08/11,
Task输出参数名
Sun, 07/08/11,
Task的输入参数
Sun, 07/08/11,
Task的名称

{ "jobId" : "JE30155054C2C416EA3CF6C88A40B94FF", "jobStatus" : "esriJobSubmitted", "messages" : [{ "type": "esriJobMessageTypeInformative", "description": "Submitted." }]}

Check Job Status

http://<task-url>/jobs/<job-id>

检测任务工单的运行状态, 需要以一定的时间间隔持续调用该 REST API 接口,

直至检测到任务工单状态为 esriJobSucceeded 或其他失败状态

Parameters

Parameter Details

f Description: The response format. The default response format is html.

Values: html | json | kmz

returnMessages Description: If true, the job messages are included in the response. The default is true.

Values: true | false

Example

http://a.com/ArcGIS/rest/services /ESRI_CadastralData_Portland/GPServer/MailingList/jobs/ JE30155054C2C416EA3CF6C88A40B94FF&f=json

{ "jobId" : "JE30155054C2C416EA3CF6C88A40B94FF", "jobStatus" : "esriJobSucceeded", "results" : {

Sun, 07/08/11,
上一步返回的jobId
Sun, 07/08/11,
工单运行状态标识

"Output_Long" : {"paramUrl" : "results/Output_Long"}, "Output_Feature_Class" : {"paramUrl" : "results/Output_Feature_Class"} }, "inputs" : { "Input_String" : {"paramUrl" : "inputs/Input_String"}, "Input_Feature_Class" : {"paramUrl" : "inputs/Input_Feature_Class"} }, "messages": [{ "type": "esriJobMessageTypeInformative", "description": "Submitted." }, { "type": "esriJobMessageTypeInformative", "description": "Executing..." }, { "type": "esriJobMessageTypeInformative", "description": "Succeeded." }]}

Get Job Result

http://<job-url>/results/<param-name>

Parameters

Parameter Details

f Description: The response format. The default response format is html.

Values: html | json | image | kmz

outSR Description: The spatial reference of the output geometries.

The spatial reference can be specified as either a well-known ID or as a spatial reference json object.

This parameter is applicable for result parameters that contain geometries. This parameter can be used to return the geometries in a spatial reference that is different from the spatial reference in which the outputs were initially created.

returnType Description: If the GP service is associated with a result map service, the default

Sun, 07/08/11,
Task输入值对应的URL
Sun, 07/08/11,
Task输入参数名
Sun, 07/08/11,
Task输出值对应的URL
Sun, 07/08/11,
Task输出参数名

output for GPRasterDataLayer and GPFeatureSetLayer parameters is a map image. However, you can explicitly request the raw raster data by using returnType and setting its value to data.

Values: data

Example

http://a.com/ArcGIS/rest/services/ /ESRI_CadastralData_Portland/GPServer/MailingList/jobs/ JE30155054C2C416EA3CF6C88A40B94FF/results/Output_Long?f=json

{ "paramName" : "Output_Long", "dataType" : "GPLong", "value" : 1234}

GPFeatureRecordSetLayer

FeatureSet JSON 格式的空间数据, 做为 GP 的输入/输出参数值{ "paramName" : "Output_Features", "dataType" : "GPFeatureRecordSetLayer", "value" : { "geometryType" : "esriGeometryPoint", "spatialReference" : {"wkid" : 4326}, "features" : [{ "geometry" : {"x" : -104.36, "y" : 34.657}, "attributes" : { "TextField" : "a", "IntField" : 1234 } }, { "geometry" : {"x" : -114.749, "y" : 31.439}, "attributes" : { "TextField" : "b", "IntField" : 5678 }

Sun, 07/08/11,
Geometry JSON
Sun, 07/08/11,
Feature JSON
Sun, 07/08/11,
FeatureSet JSON

}] }}

如何自己实现 Flex版的 GP API

调用 REST API接口

在调用过程中遵循 GP REST API 的规范

数据格式转换

对内只使用 OpenScales 的数据格式, 对外使用 ArcGIS 特有的数据格式, 做数据适配

ArcGIS GP REST API

OpenScales ArcGIS

FeatureSet

Graphic

Geometry

Vector.< Feature>

Feature

Geometry

FeatureSet JSON