ArcGIS Buffer Geoprocessing



Description:

This sample illustrates how to work with an ArcGIS Server Geoprocessing service using the Web ADF GeoprocessingResourceManager and GeoprocessingFunctionality class. The sample assumes that a geoprocessing service has been created from the BufferTools toolbox included with the sample data here:

<ArcGIS install location>\DeveloperKit\SamplesNet\Server\data\GP\RunBuffer

The BufferTools toolbox contains one model, BufferPoints. The BufferPoints model is designed to accept two inputs: an input feature set (points) and a linear unit (buffer distance. The output is a feature set containing the buffer geometry. The input feature set determines the type of geometry that the model can buffer and its spatial reference. In this case, the layer file InputPoints.lyr defines the input geometry as point and the spatial reference as NAD_1983_Texas_Statewide_Mapping_System. The model will solve for input and output data in this spatial reference.

The sample also assumes an ArcGIS Server map service is available, in the same projection as the geoprocessing service. The data for the NorthAmerica map document can be used and is located here:

<ArcGIS install location>\DeveloperKit\SamplesNet\Server\data\NorthAmerica

The sample contains set of Web ADF controls, but is only designed to work with ArcGIS Server services.
Products:
Server: C#, VB.NET

Platforms: Windows

Minimum ArcGIS Release: 9.2

How to use:
  1. Design Time:
    1. Verify that the appropriate services are available (see description for more details).
    2. Verify that the Web ADF for the .NET Framework is installed and functioning properly. For information on installing and configuring the Web ADF, consult the installation guide.
    3. In Windows Explorer, navigate to <ArcGIS install location>\DeveloperKit\SamplesNet\Server\Web_Applications and unzip ArcGIS_Buffer_GeoprocessingCSharp.zip or ArcGIS_Buffer_GeoprocessingVBNet.zip to a location of your choice. You should see either a CSharp or VBNet folder appear where you unzipped the files.
    4. In Windows Explorer, open the directory referencing the language of your choice: CSharp or VBNet. Copy the folder, ArcGIS_Buffer_Geoprocessing_<language>, to c:\inetpub\wwwroot. The <language> variable may be either CSharp or VBNet.
    5. Open the IIS Manager from Control Panel > Administrative Tools > Internet Information Services (IIS) Manager or Internet Information Services
    6. In the console tree view on the left, navigate to Local Computer > Web Sites > Default Web Site.
    7. Expand Default Web Site then right-click the ArcGIS_Buffer_Geoprocessing_<language> folder and click Properties.
    8. On the Directory tab, click the Create button in the Application Settings section of this panel. Click OK to dismiss the Properties dialog.
    9. Launch Microsoft Visual Studio 2005 and open the ArcGIS_Buffer_Geoprocessing_<language> solution (for example, ArcGIS_Buffer_Geoprocessing_CSharp.sln) located in c:\inetpub\wwwroot\ArcGIS_Buffer_Geoprocessing_<language>.
    10. In the Solution Explorer, right-click Default.aspx and select 'Set As Start Page'.
    11. Open the Default.aspx page in design view. Open the properties window for the MapResourceManager control. Click the ellipsis next to the ResourceItems property. The ResourceItem Collection Editor dialog should display.
    12. One Graphics layer resource has been added to store the points entered by the user and the buffer geometry returned from the geoprocessing service. The Graphics resource item is not visible in the Toc.
    13. Add or change the MapResourceItem associated with a map service (ArcGIS Server, ArcIMS, ArcWeb, etc.). Any map service in the same projection as the output for the geoprocessing service will work. In this case, the NorthAmerica map service is provided.
    14. Select the GeocodeResourceManager and click the ellipsis next to the ResourceItems property. The ResourceItem Collection Editor dialog should display.
    15. Add a GeoprocessingResourceItem associated with a geoprocessing service (ArcGIS Server only). In this case, the BufferTools geoprocessing service will work.
    16. If necessary, set the runtime identity of the Web application:
      1. At design-time, the identity of the user running Visual Studio is used to connect to an ArcGIS Server local data source. At runtime, that identity is established by the Web application. Only one identity can be used to define access to all ArcGIS Server local data sources in a single Web application. This identity can be explicitly defined when building the Web ADF application in Visual Studio by right-clicking the Web project in Solution Explorer, and selecting the Add ArcGIS Identity option. Enter the identity credentials which will be used to access ArcGIS Server local resources at runtime. This information will be added to the web.config file within a standard ASP.NET identity tag. If the "Encrypt identity in web.config" checkbox is checked, the identity tag will be encrypted, otherwise the username and password will be stored as clear text.
        -or-
      2. Open the web.config file and add an <identity> element within <system.web>. Set the impersonate attribute to "true". Add a userName and password attribute and set them to a valid user account. If working with ArcGIS Server Local data sources, make sure the account has access to the GIS Server resources referenced in the Map control.
    17. Save the project.
    18. Click the "Debug" drop-down menu and choose "Start".
  2. Run Time:
    1. Browse to viewer's URL (for example, http://localhost/ArcGIS_Buffer_Geoprocessing_CSharp).
    2. In the toolbar above the map, click "Add Points".
    3. Click on the map to add graphic points.
    4. Select the buffer distance units.
    5. Enter a buffer distance.
    6. Click on the "Generate Buffer" button. The geoprocessing service will asynchronously process the request. The an indicator (animated gif) below the button will display until the GP job is finished. An initial JavaScript delay is set to 10 seconds (change this in the JavaScript at the top of the Default.aspx file).
    7. Interact with the application while waiting for a response from the geoprocessing service. Note that other controls in the Web application can be interacted with while the geoprocessing service continues to process the request.
    8. When the job is finished, the buffer polygons will be drawn on the map as a Web ADF feature graphics layer.

Download the C# files
Default.aspx Contains Web user interface to interact with server-side code.
ArcGIS_Buffer_Geoprocessing_CSharp/Default.aspx.cs Code behind the aspx file. References Web ADF libraries and functionality. Most of the GeoprocessingFunctionality work is done here.
ArcGIS_Buffer_Geoprocessing_CSharp/App_Code/PointTool.cs Adds graphic points to the map.
Download the VB.NET files
Default.aspx Contains Web user interface to interact with server-side code.
ArcGIS_Buffer_Geoprocessing_VBNet/Default.aspx.vb Code behind the aspx file. References Web ADF libraries and functionality. Most of the GeoprocessingFunctionality work is done here.
ArcGIS_Buffer_Geoprocessing_VBNet/App_Code/PointTool.vb Adds graphic points to the map.

Download the files for all languages