iShare 技术 基于ArcGIS REST API实现客户端(Flex)API -- GP服务 20110708 Sun
-
Upload
jun-sun -
Category
Technology
-
view
772 -
download
6
description
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
{ "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" : {
"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
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 }