GP service step by step: Buffer points

Complexity: Beginner Data Requirement: ArcGIS Tutorial Data Setup

Folder

BufferPoints

Purpose

Creates polygons around points.

Services

BufferService (geoprocessing service).

Geoprocessing tasks

Buffer Points

Inputs

User digitizes a point.

Outputs

Polygon

Data

None

Extensions

None

Of note

Of all the examples, this is the most basic service.

About this example

Corresponding folder

Data can be found at C:\arcgis\ArcTutor\GP Service Examples\BufferPoints. After completing all the steps described below, you will have duplicated the contents of this folder.

Data preparation

Create a toolshare folder

Steps:
  1. Start ArcCatalog.
  2. Create a new folder, BufferPts, in a location of your choice, as follows:
    1. Navigate to an existing folder of your choice.
    2. In the Catalog tree, right-click the folder and click New > Folder.
    3. Name this folder BufferPts.
  3. In the Catalog tree, right-click BufferPts and click New > Folder.
  4. Name the folder ToolData.
  5. In the Catalog tree, right-click ToolData and click New > File Geodatabase.
  6. Name the file geodatabase Schema.
  7. Using the same steps, create a folder within BufferPts named Scratch. Within the Scratch folder, create a new file geodatabase named Scratch.

Create the toolbox

In the Catalog tree, follow these steps:

Steps:
  1. Right-click the BufferPts folder.
  2. Point to New > Toolbox.
  3. Name the toolbox BufferService.

Create schema feature class

You will need a point feature class to use as a schema for the feature set variable you will use in the model described below.

Steps:
  1. In BufferPts/ToolData, right-click the Schema geodatabase and click New > Feature Class.
  2. Name the feature class Point.

    The feature type is Points.

  3. Click Next.
  4. For a coordinate system, choose Geographic Coordinate Systems > World > WGS 1984. (Although you can choose Unknown as the coordinate system, it is not good practice to do so.)
  5. Click Next.
  6. Accept the default value for XY Tolerance and click Next.
  7. Accept the default value for Configuration keyword and click Next.
  8. Click Finish (the feature class does not contain any user-defined attributes).
Completed working folder

Create the model

With the steps below, you will create a new geoprocessing model to buffer point features.

Steps:
  1. Right-click the BufferService toolbox, point to New, then click Model. This opens the ModelBuilder window.
  2. To add the Buffer tool
    1. Click Add Add Data or Tools on the ModelBuilder toolbar.
    2. On the Add Data or Tool dialog box, navigate to Toolboxes > System Toolboxes > Analysis Tools > Proximity.
    3. Click Buffer and click Add. (An alternative to this method is to drag the Buffer tool from the ArcToolbox, Search, or Catalog window onto the ModelBuilder canvas.)
      The ModelBuilder canvas now appears as follows:

      Model with Buffer process

  3. When using ModelBuilder, you often need to move and resize elements (tools and variables). In the illustration above, the output variable is actually named Output Feature Class but is truncated because of the size of the variable. To resize, click the output variable and click and drag one of the small blue selection squares. Now your model looks as follows:
    After resizing the output variable
  4. Right-click Buffer, point to Make Variable > From Parameter, then click Input Features.Making a variable from a tool parameterThe model now looks as illustrated below: Input features as a variable
  5. Right-click Input Features and click Properties. On the Input Features Properties dialog box, click the Data Type tab.
  6. In the Select data type drop-down list, choose Feature Set. On the Import schema and symbology from box, enter the path or browse to the point feature class Points you created in the above steps.Data type properties
  7. Click OK. The Input Features variable is now a blue color.
  8. Right-click Buffer, point to Make Variable > From Parameter, then click Distance [value or field]. A new model variable is created.
  9. You may need to click and drag the variable so that it is not on top of the Input Features variable and resize it to show the complete variable name.Model with distance variable
  10. Right-click the Distance [value or field] variable and click Rename. Rename the variable to Distance.
  11. Right-click Distance and click Properties. On the Distance Properties dialog box, click the Data Type tab.
  12. In the Select data type drop-down list, choose Linear Unit.
  13. Click OK.
  14. Double-click Distance (or right-click and click Open). Set the distance to 1000 meters. The Distance variable is now a blue color, and the Output Feature Class variable is a green color. This signifies that all required inputs to Buffer have been provided.
  15. Right-click the Output Feature Class variable (the output of Buffer) and click Rename. Rename the variable to Output Polygons.
  16. Double-click Output Polygons and enter %scratchworkspace%\BufferedPoints.shp Output location
  17. Click OK
  18. Right-click Input Features and click Model Parameter. P (for parameter) appears next to the variable.
  19. Right-click Distance and click Model Parameter. P appears next to the variable.
  20. Right-click Output Polygons and click Model Parameter. P appears next to the variable.

    The model should now appear similar to the illustration below: Completed model

  21. In the main ModelBuilder menu, click Model and click Model Properties
    1. Set Name to BufferPoints
    2. Set Label to Buffer Points
    3. Check the Store Relative pathnames option.

    The illustration below shows these settings: Model Properties

  22. Click OK.
  23. In the main ModelBuilder menu, click Model and click Save. Then click Model again and click Close

Test the model

In the next series of steps, you will test your model using ArcMap—always a good idea before publishing a service.

Steps:
  1. Start ArcMap and add data to create a map, or open an existing map document.
  2. In ArcMap, use the Geoprocessing menu to open both the Geoprocessing Options and Environments Settings dialog boxes.
  3. Configure the following:
    • Geoprocessing Options: Check the Overwrite the outputs of geoprocessing operations check box.
    • Geoprocessing Options: Check the Add results of geoprocessing operations to the display check box.
    • Environments Settings: Expand the Workspace category and set the scratch workspace to BufferPoints\Scratch, the folder you created above.

    These settings are illustrated below: Geoprocessing options

  4. In the Catalog window of ArcMap, navigate to your toolshare folder and choose the BufferService toolbox you created above.
  5. Double-click Buffer Points. (Optionally, you can right-click Buffer Points and click Open). This opens the Buffer Points tool dialog box, as illustrated below. Buffer Points tool dialog
  6. Click Add Feature Add feature to add a point feature to buffer. You can add more than one feature.
  7. Optionally, change the Distance parameter.
  8. Click OK.

    The tool begins to execute. When the tool finishes execution, a new layer named BufferedPoints is added to the ArcMap table of contents.

  9. Exit ArcMap. You do not need to save your changes.

Publish the service

To publish a toolbox to ArcGIS Server, you must have administrator access to ArcGIS Server. To connect to a server, expand the GIS Servers entry in the Catalog tree and click Add ArcGIS Server. Your server administrator—the person in charge of setting up and maintaining accounts for your ArcGIS Server installation—is responsible for setting up an account for you and granting you administrator privileges.

Administrator access

Once you have established an administrator connection to ArcGIS Server, you are ready to publish your toolbox.

Steps:
  1. In ArcCatalog , right-click the BufferService toolbox and click Publish to ArcGIS Server.
  2. On the Publish to ArcGIS Server dialog box, choose the server you want to publish to. Name the service BufferService (this is the default name—the same as the name of the toolbox).
  3. Click Next.
  4. Click Finish.

Learn more about publishing geoprocessing services

Use the service

In the next series of steps, you will use your geoprocessing service in ArcMap.

Steps:
  1. Open ArcMap and add data of your choosing, or open an existing map document.
  2. In the Catalog window of ArcMap, navigate to your server connection under GIS Servers.
  3. Find the geoprocessing service BufferService under the server and expand BufferService to display its contents, the Buffer Points task.
  4. Double-click Buffer Points task. (Optionally, you can right-click Buffer Points and click Open). This opens the Buffer Points task dialog box. Note that unlike the Buffer Points tool dialog box (shown above) when you tested your model, this dialog box does not show the Output Polygonsparameter. This is because ArcGIS Server writes the output polygons to a location on the server (defined by %scratchworkspace%), and there is no need for you to specify an output location. BufferPoint task dialog box
  5. Click Add Feature (Add feature) to add a point feature to buffer. You can add more than one feature.
  6. Optionally, change the Distance parameter.
  7. Be sure to turn backgroud process off to allow process dialog box appears by running following steps:
    1. Click Geoprocessing from ArcMap.
    2. SelectGeoprocessing Options
    3. If the Enable check box of Background Processing is checked, uncheck it. Otherwise leave the way it is.
  8. Click OK.
  9. Click Geoprocessing menu > Results, expand Current Session, then expand the BufferPoints entry. Note how you can view outputs, inputs, environments, and messages for the execution of the task. Anytime you execute a geoprocessing tool, a result is written to the Results window.

    It should only take a few moments for the task to complete. A new layer is added to the ArcMap table of contents. This layer is named Output Polygons [<time>_<date>], as illustrated below. Output Polygons layer

In the next series of steps, you will be modifying the BufferService properties and running the Buffer Points task again to see the effect of changing these properties. Therefore, you do not want to exit ArcMap.

Modifying service properties

By changing service properties, you can affect how tasks execute.

Steps:
  1. In the Catalog window, navigate to the server containing the BufferService geoprocessing service.
  2. Right-click BufferService and click Stop. Geoprocessing services must be stopped before their properties can be changed.
  3. Right-click BufferService and click Service Properties.
  4. Click the Parameters tab.

There are three basic parameters that you can modify that affect how the task executes. Change these parameters as discussed below, click OK, then start the service (right-click BufferService and click Start). Then run the task again in ArcMap to see the effect.

Execution type

Synchronous means that the client waits until the server has finished executing the task. Asynchronous means that the client is free to do other work while the server executes the task. You should choose synchronous only for tasks that execute quickly.

BufferService has one task, Buffer Points, and this task executes quickly. Change the execution type to synchronous, restart the service, then execute Buffer Points again. With synchronous execution, the progress dialog box remains open until the task is finished executing.

Maximum Number of Records Returned by Server

The number you enter is the maximum number of records or features that can be transferred from the server to the client. A value of 0 means no records can be transferred. The default is 1000. After stopping the service, change the value to 0, restart the service, then execute Buffer Points again. The task executes and a layer is created, but there are no features since the maximum is set to 0. If you view the result on the Results window, Output Polygons has <data exceeds transfer limit>.

Show Messages

Geoprocessing models write messages during the execution of model processes. These messages include warnings, errors, and other information. The messages can contain paths to data residing on your server or local area network, and you may not want the paths to this data to be viewed by users. By default, messages are not shown.

Check the checkbox next to Show Messages, restart the service, then execute Buffer Points again. You should see more messages in both the progress dialog box (if the service is running synchronously) and in the result.

When you are developing and testing services, you almost always want to show messages.

Related Topics


4/15/2011