How to query Junctions with Python

10-05-2010 07:06 AM
New Contributor III

I have a network dataset representing a road network (in a FGDB, ArcGIS 10). Using the "Network Identify" tool, I can click on any Junction point and it returns the list of all adjacent edges and junctions.

How can I get the same information using Python?

The purpose is to write a script that iterates over all Junction points and compute some topology statistics while ignoring those Junctions that have less than three adjacent edges. If there is another way of doing that, I would be interested to know it, but still I would like to learn how to do it the Python way.

Thanks for any help or pointer.

Tags (2)
0 Kudos
1 Reply
Esri Contributor

  To achieve your work flow you need to make use of the QueryJunction method on the INetworkQuery interface. This functionality is not exposed via python. So in order to make this functionality available via python  you have some options.

  1. Write a Console application in either .NET (using C# or VB.NET) or Java that takes in a path to the network dataset and performs this computation. You can then call this standalone application from your python script. The console application will run in a separate process as compared to your python script.

  2. Write a custom geoprocessing (GP) tool in either .NET language or Java that takes in a network dataset and performs the computation. You can then call this custom GP tool from your python script. The benefit of writing a custom GP tool is that the tool will behave  like any other GP tools and it will also run in the same process as your python script. However you will have to ensure that the custom GP tool is installed on the machine before you can call it. Refer to the documentation about writing custom GP tools in .NET or writing custom GP tools in Java.

Option #1 is relatively easy to develop but Option#2 will give you more geoprocessing like experience in your python script.

Hope this helps
0 Kudos