Using a point specified by the user, perform a trace on a geometric network Montgomery (map service), TraceGeometricNetwork (geoprocessing service).
Montgomery (map service), TraceGeometricNetwork (geoprocessing service).
Geometric Network, point location from which to start trace.
A feature layer containing the system valves features output from the trace.
The example uses a water network to demonstrate the tracing capabilities through geoprocessing.
The data for this example can be downloaded from ArcGIS.com. Once downloaded, extract the zip file to C:\arcgis\ArcTutor\. The GP Service Examples\TraceGeometricNetwork folder contains the completed models and data.
About this example
This example shows the detailed steps of sharing and using a map and a geoprocessing service. The model TraceGeometricNetwork used in the service is derived from the Trace Geometric Network tool. The geoprocessing task lets you select a point on a water network from which to run a trace. The result of the trace will be a feature layer containing all the values upstream from the start of the trace.
The study area for this example is a water network. Data includes standard aspects of a water network such as mains, laterals, and valves. Also included are roads and parcels for the area of interest. The data can be found in C:\arcgis\ArcTutor\GP Service Examples\TraceGeometricNetwork\ToolData\Montgomery.gdb.
Model and tool data
The toolbox for the geoprocessing service is TraceGeometricNetwork.tbx, and the source map document for the service is TraceGeometricNetwork.mxd. TraceGeometricNetwork.mxd contains several source data layers: a layer for each feature class in the geometric network as well as layers for roads and parcels. Only the layers that participate in the geometric network are used by the TraceGeometricNetwork model.
Open the TraceGeometricNetwork map document from your Catalog window by double-clicking it.
To better understand the model, expand the TraceGeometricNetwork.tbx toolbox, right-click the TraceGeometricNetwork model, and click Edit. The TraceGeometricNetwork model is illustrated below. There are two input variables, Flags and Barriers. Each of these variables is a feature set of points that allows you to interactively define features as input to the model.
The input points supplied by the Flags and Barriers variables are snapped to distribution main features using the Snap tool. Flag Locations is used as input for the start of the trace, and Barrier Locations is used to disable features from the trace.
The model performs an upstream trace from the snapped Flag Locations point(s) using the Trace Geometric Network tool and returns the traceResults layer identifying any valves upstream from the input flag point(s). The Select Data tool is used to extract the values, and the Make_Feature_Layer tool is used to create a layer containing just the traced valves.
Make a server connection managing for publishing
Make sure you have the permission to publish to the server. If you do, follow the steps below to create a publisher or management connection to a server:
- Go to GIS Servers > Add ArcGIS for Server to bring up the Add ArcGIS Server dialog box.
- Check Publish GIS Services or Administer GIS Server.
- On the General panel, enter a value for Server admin URL and provide values for User Name and Password.
- Click Finish to complete the connection.
Share a map service
Follow the next steps to create a map service that users of your service can use as a reference map:
- From the Catalog window, navigate to C:\arcgis\ArcTutor\GP Service Examples\TraceGeometricNetwork.
- Open TraceGeometricNetwork.mxd.
- From the ArcMap main menu, choose File > Share As > Service. The Share As Service wizard opens.
- In the first panel of the Share As Service wizard, choose Publish a Service and click Next.
- In the Choose a connection drop-down list, choose the name of the server you connected to previously. The default value for Service name is TraceGeometricNetwork (the name of the map document). You can accept the default name or enter a new one.
- In next panel, provide your service folder or accept the default of [root] and click Continue. The Service Editor dialog box opens.
- In the Service Editor, click the Capabilities tab. Mapping and KML are checked by default. KML capability is not needed for this service, so uncheck the KML check box.
- Click the Item Description tab and enter the required text for Summary and Tags.
- Click the Analyze button on the upper right of the Service Editor. The Prepare window opens.
- If you see any warning or error messages in the Prepare window, fix them by right-clicking the row with the error or warning message and clicking the highlighted message.
- After you've resolved any errors, click the Publish button on the upper right of the Service Editor. You should get a successful message when publishing completes.
The TraceGeometricNetwork map service is published and ready for use.
Share a geoprocessing service
- In the Catalog window, navigate to C:\arcgis\ArcTutor\GP Service Examples\TraceGeometricNetwork.
Although you do not need to make any edits to the data and documents in this directory, a good practice is to copy and paste the entire TraceGeometricNetwork directory to another local directory. This allows you to explore the data and documents in the copied directory and make edits while preserving the original contents.
- Open TraceGeometricNetwork.mxd.
- Run the TraceGeometricNetwork model tool to create an output layer:
- From the ArcMap main menu, choose Geoprocessing > Environments. The Environment Settings dialog box opens.
- Click the Workspace category.
- In the Catalog window, click the Go To Home Folder button . Expand TraceGeometricNetwork.tbx and double-click the model tool TraceGeometricNetwork to open its dialog box.
- For the Flags parameter, click along a distribution main from which you want to start the trace.
- Click OK to run the tool.
When the tool finishes executing, a new result is written to the Results window. To open the Results window, choose Geoprocessing > Results in the ArcMap main menu.
- Check that the tool executed successfully by examining the result in the Results window. A failed execution displays an error icon next to the result.
- In the Results window, right-click the TraceGeometricNetwork result and choose Share As > Geoprocessing Service. The Share As Service wizard opens.
- Choose the server you connected to previously and publish to the same folder as the map service you created previously. The default name of the service is the same as the tool name, TraceGeometricNetwork. You can accept the default service name or enter a new name.
- On the last panel of the Share As Service wizard, click Continue to open the Service Editor.
Using the geoprocessing service
The following steps show how to use the map and geoprocessing services that you previously published.
- Open a new ArcMap document.
- In the Catalog window, do the following:
- Navigate to your server connection under GIS Servers, select the map service TraceGeometricNetwork, and drag it into the ArcMap table of contents.
- Expand the TraceGeometricNetwork map service in the table of contents. You see all the layers belonging to the TraceGeometricNetwork map service.
- In the Catalog window, navigate to your server connection under GIS Servers, find the geoprocessing service that you published in the previous section, and expand it. The task TraceGeometricNetwork appears.
- Double-click the TraceGeometricNetwork task to open the task dialog box.
- On the TraceGeometricNetwork dialog box is the Flags parameter as illustrated below. Click the Flag parameter in the tool dialog box and click a distribution main in the map service from which you want the trace to start. Optionally, click the Barriers parameter and click on a distribution main feature to block the trace from any of those features. If you choose not to specify any barriers, a warning that empty output will be generated is displayed.
- Click OK to run the geoprocessing task.
The output is returned from the server and written to the location set in your geoprocessing scratch workspace environment.
When the task completes, the output is added to ArcMap as a feature layer.