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 for Desktop ArcGIS Server Publish JavaScript Flex Mobile APIs Silverlight
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 Input parameters ArcGIS Server 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. Web Applications ArcGIS Server JSON JSON FeatureSet Parser Points, Lines, Polygons Feature Class Used as Input
Defining Schema How can clients define schema? By sending appropriate JSON { "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"}} ]
Empty Default Schema Empty default value (schema) represents support for any geometry and any fields. Caution: Clients must specify schema!
Output Featuresets Output Featuresets will also have Fields property. { "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"}} ]
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 Web Applications JSON input ArcGIS Server JSON output GP Tasks with RMS Web Applications JSON input ArcGIS Server JSON output + Map Service Info: RMS is supported only for asynchronous execution
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 File ArcGIS Server itemid Web Applications itemid ArcGIS Server 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!