Tag Archives: Geoprocessing
ArcGIS Server 9.3 Nationwide Seminar Series occurring now
ESRI has been working on two, half-day
ArcGIS Server 9.3 Seminars. These seminars started September 23rd and
are taking place through November within the U.S. This is a great opportunity
to see how to implement ArcGIS Server to its fullest capabilities.
The first seminar, which takes place during the morning, is “Tips and Tricks”.
It was derived by gathering the most common questions people have when
implementing ArcGIS Server and best practices. There are three main sections:
configuration and management, caching, and geoprocessing. This seminar provides
useful tips for configuring ArcGIS Server and understanding architecture, how
you can set up caching strategies and workflows for high performing web
applications and how to author and publish geoprocessing services for advanced
analysis over the web.
The second seminar, which takes place during the afternoon, is titled “Creating
Mashups Using the ArcGIS API for JavaScript”. The ArcGIS Server API for
JavaScript is new at 9.3 and provides html and JavaScript developers a quick
path for making great web mapping applications. This seminar covers the basics
and getting started with the API for JavaScript. In addition to creating
mashups, discussion on query tasks, geoprocessing, geocoding and other topics
are covered so you can see how GIS analysis can be done over this easy to use
API. You can take a quick glance of the demos that will be discussed by
downloading the sample code from the ArcGIS JavaScript API
Code Gallery.
Both seminars provide a great resource for maximizing the potential of ArcGIS
Server. The seminars also provide workbooks to attendees so they can revisit
the useful tips back in the office. Sign up online to attend an
ArcGIS Server 9.3 Seminar.
The ESRI technical staff hope to see you at a seminar in a city near you!
Contributed by Jeremiah Lindemann, co-designer of the “Creating Mashups Using the
ArcGIS API for JavaScript” seminar.
Video explains "Parcel Notification List" JavaScript example
Currently the most popular download on the
ArcGIS JavaScript API Code Gallery is the
Parcel Notification List application written and submitted by Jeff
Archer from ESRI. In
this video Jeff takes a few minutes to show how the sample works and
gives a quick run-through of the code and components under the hood.
While local governments may be able use the application “as-is”, there is enough
starter material for any Web application that needs to select features based on
a distance from other features and return tabular attributes of the results.
Download it, use it, modify it… it’s up to you. And please leave comments on
the download page if you have any questions or suggestions you think might help.
Contributed by Jim Barry of the EDN team.
Publishing a geoprocessing Select tool to ArcGIS Explorer
In this post, guest author Jeff Barrette of ESRI Olympia explains how to create a
geoprocessing service for selecting features in ArcGIS Explorer.
ArcGIS Explorer users may want to zoom to specific locations based upon data
that is available to them either locally or from a server. In ArcGIS Desktop,
users can simply select features of interest based upon feature attribute
values and then zoom to the extent of the resulting selected features. ArcGIS
Explorer does not have the equivalent of a Select By Attribute function
available but it can easily be added as a custom task. This post discusses the
steps necessary to build a geoprocessing select task that can be added into
ArcGIS Explorer to give users zoom to selected features functionality.
The general steps include first using ArcGIS Desktop to build a map document
(MXD) that contains the feature layers that need to be queried along with the
resulting selection symbology. The next step involves building a geoprocessing
model or script that performs the selection capabilities. Next, the
geoprocessing tool and the results map document need to be published and served
using ArcGIS Server. Finally, the new capabilities are added into ArcGIS
Explorer as a new, custom task.
For this example, the data referenced in the steps below is the States feature
class that is available from the ESRI Data and Maps data collection. The data
is located on the ArcGIS 9 Data & Maps StreetMap USA DVD under the
usacensus folder. This post is written for use with ArcGIS Desktop 9.2 (SP5),
ArcGIS Server 9.2 (SP5), and ArcGIS Explorer (build 440).
Setup
-
Create a new folder on the file system called “SelectTask”.
It is best to organize all of the components necessary to publish a
geoprocessing task (file based data, SDE connection files, MXDs, toolboxes,
etc) in a single location to minimize file access and permission issues. The
graphic below also includes a folder called Publish. It is used to organize all
published tasks as individual project folders.
- Copy the states feature class to this new location.
-
Set the appropriate permissions.
Ideally, this folder is located on the same machine that ArcGIS Server is
installed on. If the data is on the server, then permissions on the data should
be all set. If on a different network drive, this folder should be shared and
the SOC account should be granted access to it. -
Create a connection to the ArcGIS Server as an admin user.
If this is the first time you are publishing something to ArcGIS Server, you
are first required to establish a connection to the server. -
In ArcCatalog, expand GIS Servers.
This is a node in the Catalog Tree. - Double-click Add ArcGIS Server.
- Select Manage GIS Services and click Next.
- Provide the necessary connection information and click Finish.
Note: It is also recommended that you read through the Troubleshooting
Tips section at the end of this post before proceeding with the steps
below to ensure user accounts and permissions are set appropriately.
Designing a Map Document (part 1)
-
Open a new ArcMap session and add the States layer. It is not necessary
to modify the symbology because with the steps in this document, we will not be
consuming and displaying the map service, but rather using the layers in it to
query against its features. In the steps to follow, you will symbolize the
results layer to control how the results appear in ArcGIS Explorer (or in other
applications).Note: If your data source is an ArcSDE geodatabase, then see the Working
with ArcSDE Geodatabase Data Sources section below for some suggestions
on how to manage the ArcSDE server connections. There are some additional steps
that should be taken to ensure ArcGIS Server can connect to the data. Copying
the SDE connection file to the project folder makes access much easier to
manage rather than having to set permissions on your personal profile folders. -
Set relative paths for the data sources.
This can be set via File > Document Properties > Data Source Options.
Relative paths are not necessary if the ArcMap and ArcGIS Server applications
are on the same machine but they do make it much easier to move a project
folder from one server to another or to multiple servers all with the same data
and models. Hard-coded paths are best if there are multiple SOC machines but
all pointing to a single drive to access data. -
Check the “Overwrite the outputs of geoprocessing operations” option.
This can be set via Tools > Options > Geoprocessing tab. It is important
that the output file name remain the same after multiple executions. If this
option is left unchecked the output name would change (i.e., increment by one
each time the model is run) and the applications would not be able to reference
the correct output result. -
Uncheck the “Results are temporary by default” option.
This can be set via Tools > Options > Geoprocessing tab. If the results
are going to be used in subsequent applications, it is important the results
are not immediately cleared. - Save the MXD to the new folder location and name it “SelectStates.MXD”.
- Keep ArcMap open. You will come back to the same MXD in a few steps.
Building a geoprocessing model
-
In ArcCatalog, create a toolbox called “CustomToolbox”.
Right-click the SelectTask folder and click New > Toolbox. Your folder
should look similar to the following:
- In ArcMap, open ArcToolbox.
-
Add your CustomToolbox.
Right-click ArcToolbox > Add Toolbox, browse to the Select Task folder, and
click Open. -
Set the ScratchWorkspace environment variable to the location of your project
folder (Example: C:PublishSelectTask).
Right-click ArcToolbox > Environments > General Settings > Scratch
Workspace. It is important to do this at the application level and not just at
the tool or model level because it is the ArcMap application that needs to
manage the output data.
-
Create a new model.
Right-click your CustomToolbox and click New > Model. -
Change the Name property to “SelectStates”.
Select Model > Model Properties > General Tab. The name property cannot
include spaces or underscores. -
Also change the Label property to “SelectStates” and click OK.
The label property is what gets displayed in the client application and can
contain spaces. - Drag and drop the States layer onto the model.
-
Drag and drop the Select tool onto the model. You can find this tool in
ArcToolbox Analysis Tools > Extract > Select.Note: The Select By Attribute tool can’t be used by itself because it
does not create an output result that gets written to disk that can then be
accessed by other applications. In a model, Select By Attribute can be
connected to the Copy Features command to generate the necessary file output.
The Select command accomplishes the same end result. -
Open the Select tool.
Right-click on the tool and select Open. -
Set States to be the Input Features.
Select the layer with the blue recycle symbol next to it. This represents the
data source added into the model. The yellow icon represents a layer located in
the Table of Contents (TOC). If you choose the latter, you will have two
references to the same data and one will need to be removed. -
Set the %SCRATCHWORKSPACE% inline variable for the Output Feature Class. The
input should look similar to the graphic below:
Note: It is best to use the ScratchWorkspace inline variable when output
results are going to be referenced from other applications. The Managed option
works great for intermediate results but does not work well on permanent output
results. The Managed option will automatically increment the output name with
each successive execution therefore making it difficult for other applications
to reference the correct data. The ScratchWorkspace inline variable should be
used instead. In addition to ScratchWorkspace, also use the “Overwrite the
outputs of geoprocessing operations” option and make sure the “Results are
temporarily by default” option is turned off. These settings will ensure the
resulting output is correctly accessed by other applications. -
Build a default, optional expression (Example: “STATE_ABBR” = ‘AK’). This
can be left blank but it makes it a much easier for a user to modify an already
existing expression (i.e., its SQL structure) than it is to type one from
scratch. Click OK. -
Create Expression variable/parameter for Select tool.
Right-click the Select tool and choose Make Variable > From Parameter >
Expression. -
Click the Auto Layout and Full Extent buttons.
This will better organize your view of the model. -
Set the Expression as a Model Parameter.
Right-click the Expression object and choose Model Parameter. This will enable
a user to enter a custom expression within the published task inside the client
application. -
Right-click the Expression and rename it “Enter Expression:”. How
the expression is labeled will control how it appears in the client
application. This is also true for how you label the model. The following
graphic shows how the task will appear in ArcGIS Explorer.
-
Right-click the model output States_Select.shp and check Model Parameter.
This will persist an output result on disk. The result is what will be sent
back to the ArcGIS Explorer application. Note, when output is set as Model
Parameter it cannot also be set to intermediate (temporary data). Therefore any
results you want to send back to ArcGIS Explorer should not be intermediate. -
Check Add to Display. This parameter is only necessary for displaying the
result in ArcGIS Desktop. This is not necessary when publishing the model as a
task.
When completed, the model should look similar to the following graphic:

-
Save the model.
Click Model > Save. - Close the model. Click Model > Close.
Designing a Map Document (part 2)
-
Drag and drop the Select States tool from ArcToolbox into the top portion of the
ArcMap TOC.
This is called a Tool Layer and it can be executed from the TOC. The Tool Layer
will also include inputs and outputs to the model once it is executed. -
Run the model from the tool layer.
Right-click the Select States tool layer and select Open to open the model.
Then click OK to run the model. A layer named States_Select.shp displaying
the default selected state of Alaska should have been added to your TOC as part
of the tool layer. -
Set the symbology for the States_Select.shp layer.
However this layer is symbolized is how it will appear in a client application.
If you only want the result to appear in the ArcGIS Explorer results list but
you don’t want the feature(s) to display in the view, then set the symbology to
be nothing. -
Uncheck the top level tool layer. The tool layer is really intended only
to be used for publishing purposes. If it is turned on while running the model
from ArcMap, it won’t be consistent with the layer returned from the result via
Add to Display. The TOC should look like the following graphic:
Note: Models can be published in one of two ways:
First, publish an MXD containing geoprocessing tool layers. Each tool layer
becomes a task in the geoprocessing service. This method is a little easier
because all the symbology can be directly set within the MXD. Also,
geoprocessing capabilities are automatically recognized when the MXD is
published to ArcGIS Server. Both the data and tools can be consumed by client
applications. This will be the method used in the following sections.
Second, a geoprocessing toolbox can be directly published. Each tool in the
toolbox becomes a task in the geoprocessing service. If you want to control the
appearance of the input and output results, then you would need to create
additional layer files with the desired symbology that are referenced by the
tools. Publishing stand alone tools does have an advantage over publishing tool
layers.
Publishing the map with geoprocessing capabilities
- In ArcCatalog, browse to the SelectTask folder.
-
Right-click the SelectStates MXD and choose Publish to ArcGIS Server. The
first panel allows you to select an ArcGIS Server, specify the name of the
service, and select or create a folder to organize your new service. You can
optionally change these settings. Click Next. -
Verify that the Mapping and Geoprocessing capabilities are checked and click
Next.
Optionally, this service could be made available to KML, WMS, or mobile
clients. -
Click Finish.
To dismiss the summary page. A new map service and a new geoprocessing service
are added to the GIS Server. Both services should be started and ready to go.
The GIS Server connection in ArcCatalog should look similar to the graphic
below:
-
Verify the service is running. A quick way to determine the service is
working before continuing is to make sure you can preview the service in
ArcCatalog. Simply select the SelectStates map service and click on the preview
tab. If you can see the States displayed, then the service is running properly.
If you don’t see anything display, then refer to the Troubleshooting Tips
section near the end of this document.
Adding the custom task into ArcGIS Explorer
- Open ArcGIS Explorer.
-
Click Select Tools > Manage Tasks
This dialog allows you to control access to the tasks that can be used within
ArcGIS Explorer. The tasks listed on the left are all those currently available
to the application, the tasks on the right are those that are actually being
used. -
Click the Get Tasks button.
This allows you to browse locally for tasks or to connect to other servers to
add additional tasks. - Make sure the Servers option is selected and click ArcGIS Server.
-
Enter the appropriate connection information.
If you are not sure of the server name or path, then look at the properties of
the SelectStates map service via a right-click > Service Properties >
Capabilities tab. Copy the URL information up to and including “/Services”.
-
Expand the resulting SelectStates toolbox, click the Select States tool,
and click Open.
The task has been made available to the application but is still not available
to the current map.
-
Click the Select States task on the left side and move it right to make it
available to the current map. Then click OK.
Using the task in ArcGIS Explorer
-
Click the Select States task in the Tasks list.
This will open the custom task in the task window. The labels and text display
exactly how you set them up in the model. -
Modify the expression found in the Task Center. Because a default expression was
created, it is easy to manipulate.
Keep in mind that this expression could be modified however someone would need
it to be (Example: “STATE_ABBR” = ‘WA’ OR “STATE_ABBR” = ‘RI’).
-
Click Run. Then double-click the result in the Results list to zoom to the
feature extent (ArcGIS Server Service Pack 5 is required to zoom to the results).
Troubleshooting Tips
-
ArcGIS Server must be properly installed using an Administrators account and
both the GIS Server and Web Applications post installs must be completed. -
The ArcGIS SOM and SOC accounts (the defaults are ArcGISSOM and ArcGISSOC) must
be a member of the Users group. -
The ArcGIS Web Services account (the default is ArcGISWebServices) must be a
member of the agsadmin group. -
Be sure that your account (the person publishing the services) is a member of
the agsadmin group. -
It may be necessary to reboot your machine in order for permissions to take
effect. -
The ArcGISSOC account must have at least read-only access to the file-based
data, the MXD files, toolboxes, and SDE connection files. If the local Users
group has access, then the ArcGISSOC account also does because it is a part of
the Users group. You would need to explicitly add ArcGISSOC if you wanted it to
have a different set of permissions than Users (e.g., read vs read/write). -
If these files (above) are on a separate network drive, then the folder must be
shared and the ArcGISSOC account must have at least read access to this shared
drive. -
The ArcGISSOC account must have read/write access to the ArcGISServer
directories. This is where the cache, jobs and output are written too. - Confirm that IIS is properly installed and running.
-
Confirm that the IIS virtual directories (argisoutput, arcgisjobs, and
arcgiscache) exist and their permissions and local path are correct. -
Confirm that a folder that matches your ArcGIS Server instance name exists.
This folder is created during the post install of ArcGIS Server and is found by
default in C:Inetpubwwwroot. -
If you’ve made changes to the MXD (e.g., selection symbology), then you will
need to stop and restart both the map service and the geoprocessing service. -
If you’ve made changes to the model, then remove the tool layer, rerun the
model and add the tool layer again. Be sure to follow the steps again as
indicated in the steps above.
Working with ArcSDE Geodatabase Data Sources
When a connection is made to an ArcSDE geodatabase data source, an SDE
connection file (*.SDE) is typically created in your Documents and Settings
folder under Application DataESRI. This folder would need to be shared and
the ArcGIS Server SOC account would need to be given permissions to the folder.
An easier way to manage this is to create a copy of the *.SDE file and copy it
to the SelectTask folder as outlined below:
- Expand Database Connections. This is a node in the ArcCatalog Tree.
-
Copy the SDE connection file. Right-click the SDE connection file
and select Copy. -
Paste the SDE connection file into the SelectTask folder.
Browse to and right-click the SelectTask folder and select Paste. -
Update all ArcMap ArcSDE geodatabase data sources to use the new connection
file. This can be done via the layer properties Source tab. Right-click
the layer, select properties. Select the Source tab, click the Set Data Source
button and browse to the new connection file. Do this for each ArcSDE
connection.
BPC and Dev Summit – Some Custom Tasks
Last week was a busy week for the entire Explorer team, with lots of interesting things happening and lots of great discussions in the Showcase area and elsewhere at Palm Springs. We appreciate all of your comments and feedback. We’ll be highlighting some of the presentations and those discussions in a series of posts beginning this week.
First, here’s a few things that were shown during the ESRI Business Partner Conference and Developer Summit plenaries. We’ve covered some of the general things that we typically demonstrate in previous posts on the ESRI Federal User Conference, Petroleum User Group meeting, and GITA, so we’ll focus on some of the different things that were shown last week.
One of the custom tasks demonstrated is one you’ll find on the Explorer Resource Center. Just choose File > Resource Center and choose the Tasks tab.

The one we chose is the Weather Finder task authored by Michael Waltuch, one of the lead designers on the ArcGIS Explorer development team. Just click to open the NMF file, which will add the task to your current session. To learn more about this task click the Description link on the Resource Center entry, or choose About Weather Finder on the task UI. You’ll learn the following:
Weather Finder locates the nearest weather station to a specified location and reports its most recent weather observations. The task is based on a reverse geocoding web service located at GeoNames.org. To learn more about GeoNames go to their web site and see the service description.
The popup window associated with the weather station includes a link to the National Weather Service’s Telecommunication Operations Center which lists more information and a 24 hour summary for the weather station.
This is a good example of a custom task which has been written using the ArcGIS Explorer SDK to work against an existing Web service – In other words it’s a mashup.
Using one of the Portland bookmarks, we right-clicked the pushpin to use the Send To capability to use this location as the starting point for the Weather Finder task. The bookmark itself is the result of a task (the Create Notes task in this case), and when you take the result of one task and send it to another we refer to that as task chaining, and you can read more about that in the Help.

Here’s the result of the Weather Finder task, the closest weather station to our Portland bookmark. In this case it’s located at the airport. If we click the result pushpin you’ll see the latest weather information in the popup, including links to the NOAA site providing more detailed information and historic data for this location.

We also used a task we obtained from the Showcase area on the Explorer Resource Center. The showcase is a place where anyone can contribute tasks, results, or other items they want to share with the Explorer community. We chose the Flickr Task authored by Rob Dunfey, a member of the ArcGIS Explorer SDK team who also authored a blog post with more details about the custom task. This task is another good example of a mashup with other existing Web-based APIs, in this case it uses the Fickr API.
Here we typed in “portland” to return the first 20 Flickr photos tagged with that keyword. Each of the results can be clicked to open a popup displaying the photo.

Another task that was shown was a custom geoprocessing task, authored using the Model Builder in ArcGIS Desktop and published using ArcGIS Server. The task’s UI was automatically generated by ArcGIS Server, based on parameters specified by the task author. The ArcGIS Explorer SDK can be used to modify its UI, but we just used the default, automatically generated one.
Here we’ve used Send To again to use our Portland bookmark as the input location for a 1 and 3 minute drive time analysis.

In upcoming posts we’ll cover more of what was shown, including some of the technical details of the plenary and workshop presentations, and also cover some of the things we showed that are coming in future releases.
Explorer at GITA
Over the last couple of posts we’ve covered ArcGIS Explorer at the Petroleum User Group (PUG) Conference and also the Federal User Conference (FedUC). We’re now at GITA, and here’s a quick recap of what was presented at last night’s ESRI dinner reception, and what will be hightlighted in the ESRI booth on the showroom floor.
Once again Explorer’s ability to add a variety of internet content and local data sources was highlighted. For many users this is essential, as many already publish services using ArcIMS and ArcGIS Server, and have wide variety of local data that must be integrated.
The City of Riverside is shown below with a 3D model of a substation. The substation is part of a citywide 3D landscape that was authored in ArcGlobe and published as an ArcGIS Server globe service. Also shown is part of the street scene, showing some of the 3D objects (trees, cars, poles) from the ArcGlobe 3D library, as well as several buildings designed using Sketchup.


Utility assets such as hydrants, poles, pipes, valves, and others can be linked to files like geo-tagged photos shown below. These linked and integrated documents can includes videos, diagrams, work orders, and other files.

A geoprocessing tool was authored that performs network tracing on the electrical network based on a trouble call location, identifying upstream and downstream infrastructure and devices that may be affected.

Changing the transparency of GeoprocessingTask results in a Map
Rex Hansen contributed this discussion about working with results of the .Net Web ADF GeoprocessingTask programmatically:
An ArcGIS Server geoprocessing service can contain server tools which generate feature output (e.g. feature class, feature layer, etc.) to be rendered in a map. The Web ADF includes an out-of-the-box GeoprocessingTask control which can be used to interact with a server tool as a geoprocessing resource in a Web ADF application.
As part of the Web ADF Task framework, a GeoprocessingTask can interact with a server tool, display tabular results in a TaskResults control, and display feature results in a Map control. When a server tool generates feature results, either the raw feature data can be returned to the client, or a map service buddied with the geoprocessing service can be used to draw the results on the server. The GeoprocessingTask maintains the boolean property DrawResultsOnMapServer to determine where feature results are drawn.
In either case, one or more map resources must be created at runtime to draw results in a Web ADF Map control. Upon successful execution of a GeoprocessingTask, the map resources are added to a MapResourceManager through the Task-TaskResults-Map-MapResourceManager buddy relationship.
If results are drawn using a map service, one ArcGIS Server map resource item is created for each set of result features when a geoprocessing job completes successfully. The results are packaged as map resources in MapResourceNodes (in ESRI.ArcGIS.ADF.Web.UI.WebControls) by the GeoprocessingTask for display within a TaskResults control. The internal framework of the TaskResults control manages adding the resources for you and eventually displaying the results in a map.
If results are drawn by the client, results are converted to Web ADF feature graphics layers in the GeoprocessingTask. Upon display in a TaskResults control, the feature graphics layers are packaged as GraphicsLayerNodes (in ESRI.ArcGIS.ADF.Web.UI.WebControls). The TaskResults control will create Web ADF graphics map resource items to contain the graphics layers; one resource item for each feature type.
For example, assume a GeoprocessingTask is buddied with a TaskResults control named “TaskResults1” and a job initiated by the task generates a polygon feature set. When the job is complete, a Web ADF graphics layer created from the polygon feature set will be added to a graphics resource item named “TaskResults1 Polygon Results”. The graphics layer associated with each GraphicsLayerNode will be added to the graphics map resource item based its feature type (e.g. Point, Line, Polygon). If a graphics map resource is already available for a certain type, all graphics layers of the same type are merely added to it. All GeoprocessingTasks which share the same TaskResult control will also share the same graphics map resources. The internal framework of the TaskResults control manages displaying the graphics map resource for you.
By default, the transparency setting for all map resources created for MapResourceNodes and GraphicsLayerNodes is 25 (25%). In addition, by default the symbols for features in a feature graphics layer created by the GeoprocessingTask have a transparency value of 0 (0%). Note that map resources and graphics layers are two different entities. A Web ADF graphics map resource can contain many Web ADF graphics layers. The transparency settings of a feature layer renderer will be coupled with transparency defined for a map resource as a whole. The GeoprocessingTask does not maintain a public property to change the transparency of results. Consequently, the GeoprocessingTask must be subclassed to interrogate and change the results generated by the task before they are rendered in a Map.
To borrow a phrase from The Narrator in the movie Fight Club, let’s create a “single-serving” task only for use within the Web application it resides. The custom task will override the transparency of results generated by a GeoprocessingTask. Note that the techniques introduced in this example can also be applied to other Web ADF tasks.
-
Create a new Web application (C#). Add MapResourceManager, Map, and TaskResults
controls to the page. Buddy up the Map-MapResourceManager and TaskResults-Map. -
Add a TaskManager and Menu control to the page. Buddy up the TaskManager-Menu
control. This step is not essential, but makes it easier to reinitialize the
task by clicking on a menu item at runtime. -
Add a GeoprocessingTask to the TaskManager and buddy it up with the TaskResults
control. In this example we will modify the out of the box GeoprocessingTask,
so it’s easiest to start with one in the page and replace the reference once we
have the custom task built. -
Add a map resource and geoprocessing resource. The outputs from the
geoprocessing resource should be in the same coordinate system as the map. At
this point, the application should appear similar to the following:
-
Create a new class file in the Web application’s App_Code folder. Name the file
CustomGeoprocessingTask.cs. The next set of steps will discuss adding code to
this file. See the sample included with this post to view the code. -
Create a class named CustomGeoprocessingTask that subclasses the
ESRI.ArcGIS.ADF.Web.UI.WebControls.GeoprocessingTask class and wrap it in the
namespace CustomTasks.namespace CustomTasks
{
public class CustomGeoprocessingTask :
ESRI.ArcGIS.ADF.Tasks.GeoprocessingTask
{ . . . -
Add a property to retrieve the first TaskResults control buddied to the custom
task. This will require you to work with the TaskResultsContainers property of
the task. In the sample, two internal methods are used to iterate through the
controls in the page to locate the appropriate TaskResults control. -
Override the GetCallbackResults() method to work with results generated by the
custom GeoprocessingTask. Call GetCallbackResults() in the base class first -
this will generate a set of results based on user inputs. The Results property
of the task will store the output results to be read by the TaskResults control
and rendered by the Map control. The Results property will usually contain a
set of TreeViewPlusNodes.If results are to be rendered by the client, GraphicsLayerNodes will contain Web
ADF feature graphics layers with the output features. Change the transparency
value of the selected renderer symbol associated with the feature graphics
layer. Since the graphics layer is added to the map as part of a resource, find
the dynamic Web ADF graphics map resource that contains the graphics layer and
change the transparency of its display settings. Each feature graphics layer
created as a result from a geoprocessing job is given a unique name.If results are rendered on the server, MapResourceNodes will reference dynamic
map images generated on the server. Find the dynamic ArcGIS Server map resource
generated to render the results and change the transparency of its display
settings. -
Once finished, compile the Web project. Then add the following reference to the
top of the aspx page:<%@ Register Assembly="App_Code" Namespace="CustomTasks" TagPrefix="customTasks" %>
-
In the aspx page, change the tag associated with the out-of-the-box GeoprocessingTask to reference the custom GeoprocessingTask.
Change the open and close tags from:
esriTasks:GeoprocessingTask
-to-
customTasks:CustomGeoprocessingTask
As an example, the following screenshots illustrate the difference between the default transparency values associated with results from the GeoprocessingTask and a transparency value of 0 (not transparent) associated with a custom GeoprocessingTask. In this example, the results were drawn on the server.
Default transparency values:

Custom transparency value of 0:
New geoprocessing tutorial in online help
A new tutorial explaining how to add geoprocessing to Web applications became available today in the ArcGIS Server Web-based help. This tutorial walks you through the process of building a model and creating a map to display the model inputs and results. It then shows how to publish both the map and the model as services and add them to a Web Mapping Application.
To complete the tutorial, you need a few simple GIS datasets and ArcGIS Server for the Microsoft .Net Framework. You also need access to ArcMap. Give it a try and leave us a comment about your experience!
Displaying a perimeter for all polygons in a dataset
By Charlie Frye, Esri Chief Cartographer
![]()
We were asked, not long ago:
“I’ve got a dataset with polygons that represent the extent of field study areas at different dates; these study areas have grown over time and I want to show a single polygon that represents each site’s current study area, while still allowing me to Identify anywhere within the area, be able to see other features inside of the study areas, and I cannot be saddled with a geoprocessing experience every time I need to make my status maps for any of the study areas; How can I do this?” Continue reading
User Conference 2007: Technical workshops to attend if you want to get more out of your existing ArcGIS Server deployment
Some technical workshops at the conference are appropriate for all ArcGIS Server users, even if you’ve installed the product before and you’re already familiar with it. These workshops can help you make better use of your existing deployment:
Designing, Deploying, and Using Cached Map Services
Map caching is the recommended way to make your ArcGIS Server maps run as fast as possible. Presented by the authors of this very blog, this workshop covers basic to advanced topics in map caching. This workshop is offered three times, and is a good one to catch on Friday morning if you have a late flight.
Creating and Using ArcGIS Server Geoprocessing Services
This workshop shows how to use geoprocessing services to send GIS work to the server and get back the results when the work is done. When you use geoprocessing services, you don’t have to copy and distribute your toolboxes to everyone, and the model runs on the server, freeing up your own computer’s resources.
Deploying and using ArcGIS Explorer
If you’ve only “played with” ArcGIS Explorer, this workshop will help you reach the next level to understand how you can deploy and use Explorer in your organization. This workshop, presented by Bern Szukalski and Mark Bockenhauer, is appropriate for ArcGIS Explorer beginners as well.
ArcGIS Server: The Road Ahead
A large number of you mentioned in the pre-conference surveys that you want to know what’s in the next release of ArcGIS. The “Road Ahead” workshops are meant just for you. At this workshop you’ll hear development and product leads explain what’s coming for ArcGIS Server in 9.3 and beyond.
Publishing and using a geoprocessing model within a map document
One of the exciting new aspects of ArcGIS Server 9.2 is the ability to publish geoprocessing models and scripts to the server. A model can be published either as a tool that can be used directly on top of any map service, or it can be published with an associated map service so that you can control the symbology of the generated layer.
To illustrate the power of geoprocessing on the server, I built an example that uses a map service and an embedded model that allows users to execute an interpolation on the server and view those results in the web mapping application. The map service contains a point dataset describing the potential water yield from water wells drilled in Douglas County, Kansas (data courtesy of the Kansas Geological Survey and the Kansas Geospatial Community Commons). The model takes in the water well dataset and a user-defined cell size. This information is passed as input parameters to the Natural Neighbors GP tool. The output is a raster dataset. The output is then rendered using a predefined layer symbology file (a layer file).
If you looked closely, you may have noticed that the model includes an embedded Python script. This script allows me to put a limit on the input cell size parameter. I want to allow the user to set the cell size (in meters) of the output raster dataset from within the web application. However, I want to make sure that the user does not enter so small of a cell size that it will negatively affect the speed of the web application. The script ensures that if the user enters anything less than 30 meters, the application will default to a cell size of 30 meters. I will have more on this in a future post.
Here are some key steps to remember when publishing a geoprocessing tool embedded in a map service.
- Create an MXD with the input layer and any other background layers that you want in your map service.
- Create a toolbox in your project directory.
- Add a new model to your new toolbox.
- The model should use one of the layers in the map document as an input parameter.
- Ensure that your map document and input map layers are at the same projection.
- Your output dataset should be written to the scratch workspace.
- Set your toolbox scratch workspace environment variable equal to a directory that is visible to your ArcGIS Server Object Container (SOC) account.
- Move your finished model to your ArcMap table of contents. This is called a tool layer.
- Execute the model from within ArcMap and verify the results.
- Turn off the output layer in ArcMap and publish to the server.
The easiest way to publish a map service with an embedded geoprocessing service is to publish the map document (using the right-click option on the map document, “Publish to ArcGIS Server”). ArcGIS Server will see that the map service has a tool layer and will load that tool as a geoprocessing service.
Once deployed to the server, it is relatively straightforward to deploy the map service and associated geoprocessing task as a web application using ArcGIS Server Manager.
Check it out here: http://serverx.esri.com/interpolationexample
Try building and publishing your own models.
What do you think?
Jeremy
