part i: authoring geoprocessing workflowspamani/geog677/... · versions to arcgis 10.1. one of the...

19
GEOG677 Internet GIS University of Maryland at College Park 1 Lab Assignment 5 Geoprocessing Service Due Date: 01/24/2014 Overview Geoprocessing is one of the original purposes or functions when GIS was invented. It provides tools and a framework for performing analysis and managing/processing the data. In Desktop GIS, geoprocessing provides a large suite of tools for performing GIS tasks that range from simple buffers and polygon overlays to complex regression analysis and image classification. To share the geoprocessing work (e.g. models) and data used, you can create a geoprocessing package which can be e-mailed to your colleagues or uploaded to arcgis.com where they can reach a broad audience. In that sense, it can be considered Web GIS. You can also create web services based on your geoprocessing workflows. These geoprocessing services can then be consumed by ArcGIS for Desktop, ArcGIS Explorer, and any web GIS applications. This lab assignment is designed to help you become familiar with creating georprocessing services and also different options for consuming these products. Specifically, this assignment is divided into four parts: Part I: Authoring Geoprocessing Workflows Part II: Creating Geoprocessing Packages Part III: Publishing Geoprocessing Services Part IV: Consuming Geoprocessing Services Part I: Authoring Geoprocessing Workflows Geoprocessing is an important part of Desktop GIS. I assume that you are familiar with the common geoprocessing tools and also the working environment (e.g. ModelBuilder). Even if you know geoprocessing well, I still recommend that you brush up on this topic from the links below. Why? There have been significant new development or changes from the previous versions to ArcGIS 10.1. One of the new developments was about geoprocessing. For example, in ArcGIS 10.1 and above, you can create geoprocessing package to share your model. Also, there are major differences in terms of publishing geoprocessing services from 10.0 to 10.1 and 10.2. Therefore, I highly recommend you to update your knowledge by reading more from the ArcGIS Resources web site.

Upload: others

Post on 18-Jul-2020

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Part I: Authoring Geoprocessing Workflowspamani/GEOG677/... · versions to ArcGIS 10.1. One of the new developments was about geoprocessing. For example, in ArcGIS 10.1 and above,

GEOG677 – Internet GIS University of Maryland at College Park

1

Lab Assignment 5 – Geoprocessing Service

Due Date: 01/24/2014

Overview

Geoprocessing is one of the original purposes or functions when GIS was invented. It provides

tools and a framework for performing analysis and managing/processing the data. In Desktop

GIS, geoprocessing provides a large suite of tools for performing GIS tasks that range from

simple buffers and polygon overlays to complex regression analysis and image classification.

To share the geoprocessing work (e.g. models) and data used, you can create a geoprocessing

package which can be e-mailed to your colleagues or uploaded to arcgis.com where they can

reach a broad audience. In that sense, it can be considered Web GIS.

You can also create web services based on your geoprocessing workflows. These geoprocessing

services can then be consumed by ArcGIS for Desktop, ArcGIS Explorer, and any web GIS

applications.

This lab assignment is designed to help you become familiar with creating georprocessing

services and also different options for consuming these products.

Specifically, this assignment is divided into four parts:

Part I: Authoring Geoprocessing Workflows

Part II: Creating Geoprocessing Packages

Part III: Publishing Geoprocessing Services

Part IV: Consuming Geoprocessing Services

Part I: Authoring Geoprocessing Workflows

Geoprocessing is an important part of Desktop GIS. I assume that you are familiar with the

common geoprocessing tools and also the working environment (e.g. ModelBuilder).

Even if you know geoprocessing well, I still recommend that you brush up on this topic from the

links below. Why? There have been significant new development or changes from the previous

versions to ArcGIS 10.1. One of the new developments was about geoprocessing. For example,

in ArcGIS 10.1 and above, you can create geoprocessing package to share your model. Also,

there are major differences in terms of publishing geoprocessing services from 10.0 to 10.1 and

10.2.

Therefore, I highly recommend you to update your knowledge by reading more from the ArcGIS

Resources web site.

Page 2: Part I: Authoring Geoprocessing Workflowspamani/GEOG677/... · versions to ArcGIS 10.1. One of the new developments was about geoprocessing. For example, in ArcGIS 10.1 and above,

GEOG677 – Internet GIS University of Maryland at College Park

2

A quick tour of geoprocessing

o http://resources.arcgis.com/en/help/main/10.2/index.html#//002s00000002000000

A quick tour of ModelBuilder

o http://resources.arcgis.com/en/help/main/10.2/index.html#//002w0000002800000

0

The first step is to create a map document.

Then, you will need to create a geoprocessing workflow. In this case, I created a model using

ModelBuilder. The workflows of this geoprocessing tool are:

1. Click anywhere on the map to identify a point

2. Define a search distance

3. Identify all the hospitals within the search distance of the point

4. Display the selected hospitals on the map automatically

Here below is the model that I created. I have posted a copy of this model so that you can use

and customize. You can also feel free to create your own model when working on this

assignment.

Page 3: Part I: Authoring Geoprocessing Workflowspamani/GEOG677/... · versions to ArcGIS 10.1. One of the new developments was about geoprocessing. For example, in ArcGIS 10.1 and above,

GEOG677 – Internet GIS University of Maryland at College Park

3

Make sure you set up the Workspace and Scratch Workspace in the Environment Settings dialog

window.

Also, in ArcMap, click on the tab – Geoprocessing and then Geoprocessing Options…

Make sure you check the small box in front of these items:

Overwrite the outputs of geoprocessing operations

Add results of geoprocessing operations to the display

Page 4: Part I: Authoring Geoprocessing Workflowspamani/GEOG677/... · versions to ArcGIS 10.1. One of the new developments was about geoprocessing. For example, in ArcGIS 10.1 and above,

GEOG677 – Internet GIS University of Maryland at College Park

4

Before you can share this geoprocessing workflow, you will have to run it first.

You must run it by double-clicking the model from ArcCatalog. Don’t run the model when it is

opened in the ModelBuilder.

Page 5: Part I: Authoring Geoprocessing Workflowspamani/GEOG677/... · versions to ArcGIS 10.1. One of the new developments was about geoprocessing. For example, in ArcGIS 10.1 and above,

GEOG677 – Internet GIS University of Maryland at College Park

5

Then, click on anywhere on the map to create a point.

Now, click on button OK.

The model should run and create the result. A new layer will be automatically added into Table

of Content. Also the hospitals meeting the criteria will be selected on the map.

Page 6: Part I: Authoring Geoprocessing Workflowspamani/GEOG677/... · versions to ArcGIS 10.1. One of the new developments was about geoprocessing. For example, in ArcGIS 10.1 and above,

GEOG677 – Internet GIS University of Maryland at College Park

6

Part II: Creating Geoprocessing Packages

Now, click on the tab – Geoprocessing and then select Results.

This will open the Results window.

Right click on the latest (successful) session and then Share As. From here you have two options:

Creating a Geoprocessing Package

Publishing a Geoprocessing Service

In this part of assignment, you will try the geoprocessing package.

A geoprocessing package is a convenient way to share geoprocessing workflows by packaging

one or more tools and the data used by the tools into a single compressed file (.gpk). All

resources (models, scripts, data, layers, and files) needed to reexecute the tools are included in

the package.

Note:

Geoprocessing packages were introduced in ArcGIS 10.1 for Desktop. You cannot create

or use geoprocessing packages with versions earlier than 10.1.

Once the geoprocessing package is created, you share a package like any other file—via e-mail,

FTP, the cloud, thumb drives, and so on.

Page 7: Part I: Authoring Geoprocessing Workflowspamani/GEOG677/... · versions to ArcGIS 10.1. One of the new developments was about geoprocessing. For example, in ArcGIS 10.1 and above,

GEOG677 – Internet GIS University of Maryland at College Park

7

There are two options for sharing the geoprocessing package:

Sharing through ArcGIS.com

Sharing through the .gpk file

Let’s try the first option for now.

Make sure you fill in the Item Description and Tags. This is required in order to proceed.

Page 8: Part I: Authoring Geoprocessing Workflowspamani/GEOG677/... · versions to ArcGIS 10.1. One of the new developments was about geoprocessing. For example, in ArcGIS 10.1 and above,

GEOG677 – Internet GIS University of Maryland at College Park

8

To make sure everything is OK, you can click on the Analyze button. If there is no error

message, then you are ready to go by clicking on the Share button. Otherwise, you need to fix the

errors.

After clicking on the Share button, it will bring up the dialog window below. You can log in

using the user ID and password for ArcGIS.com that you did in Lab 4.

If successful, you now can log into ArcGIS.com where you should be able to find the newly

created/shared geoprocessing package in “My Content” section.

Page 9: Part I: Authoring Geoprocessing Workflowspamani/GEOG677/... · versions to ArcGIS 10.1. One of the new developments was about geoprocessing. For example, in ArcGIS 10.1 and above,

GEOG677 – Internet GIS University of Maryland at College Park

9

Now, you can try the second option by saving the package into a file.

Make sure you fill in the Item Description and Tags as below.

Page 10: Part I: Authoring Geoprocessing Workflowspamani/GEOG677/... · versions to ArcGIS 10.1. One of the new developments was about geoprocessing. For example, in ArcGIS 10.1 and above,

GEOG677 – Internet GIS University of Maryland at College Park

10

If successful, you should be able to locate the geoprocessing package file in the folder that you

defined.

From there, you can share it with anyone by email, FTP, etc.

To use the geoprocessing package, you have different options. The contents will automatically

be added to your application (ArcMap, ArcGlobe, or ArcScene).

In the Catalog window, Search window, or Windows Explorer, double-click the

geoprocessing package. You can also drag the package onto the Results window or the

ArcMap canvas.

In the Catalog window, right-click the package and click Unpack.

From ArcGIS Online, open any package by clicking the Open button.

When a geoprocessing package has been opened, one or more results are added to the Results

window beneath the Shared node. To execute the tool that created the result, right-click the result

and choose Open. This opens the tool's dialog box. You can then change parameters if desired

and click OK to execute. Alternatively, you can choose Re Run to immediately execute the tool.

This is the same as opening the dialog box, leaving the parameters unchanged, and clicking OK.

Page 11: Part I: Authoring Geoprocessing Workflowspamani/GEOG677/... · versions to ArcGIS 10.1. One of the new developments was about geoprocessing. For example, in ArcGIS 10.1 and above,

GEOG677 – Internet GIS University of Maryland at College Park

11

Part III: Publishing Geoprocessing Services

A geoprocessing service contains one or more geoprocessing tasks. A geoprocessing task is a

geoprocessing tool running on a server and its execution and outputs are managed by the server.

When you share a geoprocessing result as a geoprocessing service, a corresponding

geoprocessing task is created from the tool that created the result. Task is a term that web-based

APIs (such as JavaScript, SilverLight, and Flex) use to describe routines that do work on a server

and return results.

The general steps of publishing geoprocesing services are similar to those of publishing map

services.

1. Authoring geoprocessing tasks

Usually you want to use ModelBuilder to author geoprocessing tasks.

If you have an existing model with parameters that you can run successfully in

ArcGIS for Desktop, you can share it in a service without modification.

2. Publishing geoprocessing tasks into services

3. Consuming geoprocessing services

To publish a geoprocessing service, you need a result in the Results window and an administrator

or publisher connection to an ArcGIS Server.

After successfully running the geoprocessing model, right-click the result and choose Share As >

Geoprocessing Service.

Page 12: Part I: Authoring Geoprocessing Workflowspamani/GEOG677/... · versions to ArcGIS 10.1. One of the new developments was about geoprocessing. For example, in ArcGIS 10.1 and above,

GEOG677 – Internet GIS University of Maryland at College Park

12

The Share as Service Wizard will guide you through some steps that are similar to those for

publishing map services.

When publishing, your tool is checked to make sure it has minimal documentation—a summary

and one or more tags—and you can enter these using the Service Editor.

Page 13: Part I: Authoring Geoprocessing Workflowspamani/GEOG677/... · versions to ArcGIS 10.1. One of the new developments was about geoprocessing. For example, in ArcGIS 10.1 and above,

GEOG677 – Internet GIS University of Maryland at College Park

13

Similarly, you will also need to document the tools.

Page 14: Part I: Authoring Geoprocessing Workflowspamani/GEOG677/... · versions to ArcGIS 10.1. One of the new developments was about geoprocessing. For example, in ArcGIS 10.1 and above,

GEOG677 – Internet GIS University of Maryland at College Park

14

Before publishing, it is always a good practice to use the Analyze button in the Service Editor. It

helps you identify errors and other potential issues that you need to address before you can

publish your geoprocessing service.

When analyzing your service, you'll notice three types of messages in the Prepare window. You

can right-click each message to get a quick suggestion on how you can address that specific

issue. This will also give you access to a help topic with more information, such as additional

repair options. The item in bold in the Description column is the default approach for addressing

each issue.

When a geoprocessing service is published, all output datasets in your result are copied to the

server to ensure that a result map service can initialize and run. These output datasets are needed

because a map service checks the data sources for all its layers during startup. If any dataset does

not exist, the map service fails to start.

After successfully publishing the geoprocessing service, you can find it within the REST folder

on our GIS server.

Page 15: Part I: Authoring Geoprocessing Workflowspamani/GEOG677/... · versions to ArcGIS 10.1. One of the new developments was about geoprocessing. For example, in ArcGIS 10.1 and above,

GEOG677 – Internet GIS University of Maryland at College Park

15

Part IV: Consuming Geoprocessing Services

Once a geoprocessing service is published, it can be consumed in many different ways.

Using geoprocessing services in Desktop ArcGIS

Using geoprocessing services in Python scripts

Using geoprocessing services in ArcGIS Explorer for Windows Desktop

Using geoprocessing services from ArcGIS.com

Using geoprocessing services in web applications

Since there are so many information and application scenarios, it can be difficult to go through

each one of them. To learn more details, you should refer to this web page -

http://resources.arcgis.com/en/help/main/10.1/index.html#/What_is_a_geoprocessing_service/00

570000005w000000/ (expand the section – “Using geoprocessing services”)

To use geoprocessing service in Desktop GIS, you can access it through the connection to the

GIS server. See below.

Once you locate the published geoprocessing service from the GIS server, you can simply

double-click the tool.

Page 16: Part I: Authoring Geoprocessing Workflowspamani/GEOG677/... · versions to ArcGIS 10.1. One of the new developments was about geoprocessing. For example, in ArcGIS 10.1 and above,

GEOG677 – Internet GIS University of Maryland at College Park

16

Click anywhere on the map to create a point.

Then, click OK.

Note:

It may take a few seconds for the result to be displayed in the Table of Content and also

the hospitals to be selected on the map. This is because the geoprocessing tool is run

through the Internet, not from your local computer.

Page 17: Part I: Authoring Geoprocessing Workflowspamani/GEOG677/... · versions to ArcGIS 10.1. One of the new developments was about geoprocessing. For example, in ArcGIS 10.1 and above,

GEOG677 – Internet GIS University of Maryland at College Park

17

You can also add this published geoprocessing service into the ArcToolbox. See below.

Once it’s added into the ArcToolbox, you can double-click the tool and run it, just what you

would do for a locally created geoprocessing model. The only difference is that the

geoprocessing service will take a bit longer to run.

You can also add the geoprocessing service on ArcGIS.com to share.

Log in ArcGIS.com.

Click My Content.

Click Add Item.

Navigate to the REST folder where you stored the geoprocessing service.

Note:

You must provide information about the title and tags before proceeding.

Page 18: Part I: Authoring Geoprocessing Workflowspamani/GEOG677/... · versions to ArcGIS 10.1. One of the new developments was about geoprocessing. For example, in ArcGIS 10.1 and above,

GEOG677 – Internet GIS University of Maryland at College Park

18

After adding it to ArcGIS.com, you should be able to see it listed under My Content.

Then, you can decide how to share it.

Page 19: Part I: Authoring Geoprocessing Workflowspamani/GEOG677/... · versions to ArcGIS 10.1. One of the new developments was about geoprocessing. For example, in ArcGIS 10.1 and above,

GEOG677 – Internet GIS University of Maryland at College Park

19

Lastly, you can also use the geoprocessing service in web applications such as JavaScript API,

Flex API, and Silverlight API.

You can add a result map service to web applications similar to how you add dynamic map

services. A layer in a result map service corresponds to geodataset output of the geoprocessing

task. When you add a result map service to web applications, all the output layers in the result

map service will be added to the web application.

To add a geoprocessing functionality provided by a task in your web application, follow the four

steps below:

1. Initialize the geoprocessing task.

2. Set up parameters for the task.

3. Run the task.

4. Render the results.

There are three options to add a geoprocessing in a web application: They are:

ArcGIS API for JavaScript

ArcGIS API for Flex

ArcGIS API for Microsoft Silverlight/WPF

To learn more about how to add the groprocessing service in a JavaScript web application, you

can refer to this page for details –

http://resources.arcgis.com/en/help/main/10.2/index.html#//005700000064000000 Note: This

part of exercise is optional. You should try if you have time and interest.

Your tasks:

You need to go through all the steps that have been discussed from Part I until Part IV.

You can use the same model that I created. Or, you can also create your own model if

you wish.

Be creative!

----- THE END -----