Using Geoprocessing Services with ArcGIS Web … geoprocessing task provides a unique geoprocessing...
Transcript of Using Geoprocessing Services with ArcGIS Web … geoprocessing task provides a unique geoprocessing...
Using Geoprocessing Services with ArcGIS Web Mapping APIs
Monica Joseph, Scott Murray
Please fill session survey.
What is a Geoprocessing Service?
• A geoprocessing service is a set of geoprocessing tools running at server.
ArcGIS Server
Flex
Silverlight
JavaScript
Mobile APIs
ArcGIS for Desktop
Publish
What is a geoprocessing task?
• A geoprocessing task provides a unique geoprocessing functionality.
• A geoprocessing service can have more than one geoprocessing task.
• Each task has a REST URL. • REST URL: http://<catalog-url>/<serviceName>/GPServer/<taskname>
Example of GP Task
Task Parameters
• Every Task has its own parameters • Task Parameters are of two categories:
- 1. Input parameters - 2. Output parameters
Web Applications ArcGIS Server Input parameters
Output parameters
Task parameter
• Types: - FeatureSet - RecordSet (Tables) - Raster - Linear Unit (100 Km, 50 Miles…) - File (.xml, .gpx, .txt, .zip ….) - Integer, Long, Double - Date - Boolean
Task Operations
• Task supports two kinds of operations 1. Execute Task : For faster processes
- Execution Mode : Synchronous 2. Submit Job : For long running processes (more than
10 secs) - Execution Mode : Asynchronous
Tasks in Web Applications
Tasks in Web Applications
• Geoprocessing tasks can be accessed through all ArcGIS Web APIs in four simple steps
1. Initialize task 2. Setup task parameters 3. Run the task 4. Get results from the task.
Demo Using tasks
Recap
• What is a Geoprocessing Service ? • Task, its Parameters and Execution type • Using tasks in web applications
- Use graphics as input featureset - Execute Synchronous execution - Draw a chart with the result
10.1 Goodness Improved Featureset parser
10.1 Goodness – Improved Featureset Parser
• Input schema sent by the client takes precedence over default schema defined by the task.
• Empty input schema to indicate support for all geometry types and fields.
• Output Featuresets return field property.
What is Featureset Schema?
• Featureset Schema = GeometryType + Spatial Reference + Fields (attributes) • Default value of a featureset parameter represents
the default schema for input featuresets.
Why is schema important?
• Schema is important to create feature class at the server.
• Schema may come from client, if not use default schema.
ArcGIS Server
JSON
JSON
Feature Class
Web Applications
Points, Lines, Polygons
FeatureSet Parser
Used as Input
Defining Schema How can clients define schema?
{ "geometryType" : "esriGeometryPoint", "fields":[ {"name":"Id","type“: "esriFieldTypeOID","alias":"Id"},
{"name":"Name","type":"esriFieldTypeString","alias":"Name“}], "spatialReference" : {"wkid" : 4326},
"features" : [ { "geometry" : {"x" : -104.44, "y" : 34.83,
"spatialReference" : {"wkid" : 4326}},
"attributes" : {"Id" : 43,"Name" : "Feature 1"}},
{ "geometry" : {"x" : -100.65, "y" : 33.69,
"spatialReference" : {"wkid" : 4326}},
"attributes" : {"Id" : 42,"Name" : "Feature 2"}} ]
}
• By sending appropriate JSON
Empty Default Schema
• Empty default value (schema) represents support for any geometry and any fields.
Caution: Clients must specify schema!
Output Featuresets
{ "geometryType" : "esriGeometryPoint", "fields":[ {"name":"Id","type“: "esriFieldTypeOID","alias":"Id"},
{"name":"Name","type":"esriFieldTypeString","alias":"Name“}], "spatialReference" : {"wkid" : 4326},
"features" : [ { "geometry" : {"x" : -104.44, "y" : 34.83,
"spatialReference" : {"wkid" : 4326}},
"attributes" : {"Id" : 43,"Name" : "Feature 1"}},
{ "geometry" : {"x" : -100.65, "y" : 33.69,
"spatialReference" : {"wkid" : 4326}},
"attributes" : {"Id" : 42,"Name" : "Feature 2"}} ]
}
• Output Featuresets will also have Fields property.
Recap
• Input Featureset Schema - What is schema and why is it important?
• 10.1 goodness - Client defined schema takes precedence. - No schema input featureset - Output featureset returns field property
Demo 10.1 Featureset
Result Map Service
Result Map Service (RMS) Task results are returned as map service
• GP Tasks without RMS
Info: RMS is supported only for asynchronous execution
Web Applications ArcGIS Server JSON input
JSON output
Web Applications ArcGIS Server JSON input
JSON output +
Map Service
• GP Tasks with RMS
RMS Advantages
• Supports large dataset return values. • Pre-cooked symbology. • Raster outputs as layers. • Support for advanced layers such as TIN, CAD etc.
10.1 Goodness Improved Result Map Service
Improved RMS
• Easy to access map service and its layers • Download features based on query (Web API Feature
Layer support) • Dynamic Legends • Time enabled layers • Attachments and esriHTMLPopup support
In one word: 10.1 RMS is a true Dynamic Map Service!
Demo: Result Map Service
Recap
• RMS is a map service of task results. • 10.1 RMS is a true dynamic Map Service. • Demo:
- Asynchronous execution of tasks - Using RMS layers
File Inputs
Files in Geoprocessing Services
• Files such as gpx, csv, photos, zip files are processed using geoprocessing tool.
• Some examples: - GPX to Features - Table to Table (csv input) - Geotagged Photos to Points
• Other file types can also be processed using Python.
10.1 Goodness File Uploads
File Uploads
• New capability for Geoprocessing Service : Uploads • Enabled/Disabled when publishing geoprocessing
service
What is File Upload
• Upload local input files to ArcGIS Server. • Use uploaded file as input to Geoprocessing tasks
Web Applications ArcGIS Server File
itemID
Web Applications ArcGIS Server itemID
Task Output
itemID
• itemID refers to a file living in ArcGIS Server. • itemID can be specified as input to Raster and File inputs of
tasks. • JSON representation of itemID.
- Example: {itemID: “i2e56c31c-70b8-40d9-9b4e-687f6b6110ea”}
Demo: Uploading Files
Recap
• Uploads is a new geoprocessing service capability. • ItemID can be used as input to Task parameters.
Questions ?
Please fill session survey!