Deploying Export Network as a service

700
3
Jump to solution
10-16-2019 11:41 AM
Labels (2)
ColinSchut
New Contributor III

Hi all,

I am currently attempting to publish the export network tool as a service so it can be called by external software. Publishing the geoprocessing service is fine, but the output is a zip file. Trying to include the tool in a script that can unzip the file fails because arcpy has no ExportNetwork object. Is the tool being deprecated/not supported? Are there other workflows that may be more appropriate?

We've also had issues with using a service published directly from the ALRS network, and I thought this might be an easier solution for our needs...

0 Kudos
1 Solution

Accepted Solutions
AmitHazra
Esri Contributor

Hello Colin

The easiest way to access this GP Tool is to add it to a custom toolbox and then reference that toolbox in your python code.

1) Create a new toolbox: http://desktop.arcgis.com/en/arcmap/latest/analyze/managing-tools-and-toolboxes/creating-a-custom-to...

2) Right click the toolbox and add a new  built-in tool: http://desktop.arcgis.com/en/arcmap/latest/analyze/managing-tools-and-toolboxes/adding-tools.htm#GUI...

3) Browse to your installation of Roads and Highways Desktop and look for the Location Referencing Tools:  Ex: C:\Program Files (x86)\ArcGIS\LocationReferencing\Desktop10.7\ArcToolBox\Toolboxes

4) Check the Export Network GP Tool to add it to your new toolbox

Now you can access this toolbox through some super basic Python like this:

arcpy.ImportToolbox('C:\GISTemp\MyToolbox.tbx', 'LrsTool')‍
arcpy.LrsTool.ExportNetwork(add your GP arguments here...)
‍‍‍‍‍

Good luck,

Amit@Esri

View solution in original post

0 Kudos
3 Replies
AmitHazra
Esri Contributor

Hello Colin

The easiest way to access this GP Tool is to add it to a custom toolbox and then reference that toolbox in your python code.

1) Create a new toolbox: http://desktop.arcgis.com/en/arcmap/latest/analyze/managing-tools-and-toolboxes/creating-a-custom-to...

2) Right click the toolbox and add a new  built-in tool: http://desktop.arcgis.com/en/arcmap/latest/analyze/managing-tools-and-toolboxes/adding-tools.htm#GUI...

3) Browse to your installation of Roads and Highways Desktop and look for the Location Referencing Tools:  Ex: C:\Program Files (x86)\ArcGIS\LocationReferencing\Desktop10.7\ArcToolBox\Toolboxes

4) Check the Export Network GP Tool to add it to your new toolbox

Now you can access this toolbox through some super basic Python like this:

arcpy.ImportToolbox('C:\GISTemp\MyToolbox.tbx', 'LrsTool')‍
arcpy.LrsTool.ExportNetwork(add your GP arguments here...)
‍‍‍‍‍

Good luck,

Amit@Esri

0 Kudos
ColinSchut
New Contributor III

I get the error:


"Traceback
<module> 
TypeError: ExportNetwork() takes no arguments (9 given) "

when trying this with the ExportNetwork tool. It did work with another tool (I tried it with Buffer).

Putting the tool in a model and trying to run it that way returns a tool is not valid error.

0 Kudos
AmitHazra
Esri Contributor

Hello Colin - Export Network is expecting up to 9 arguments:

When you open the parentheses on the tool it should look similar to:

-Amit@Esri

0 Kudos