Get Count for Network Dataset Elements

1510
7
09-14-2016 08:12 AM
RachelAlbritton
Occasional Contributor III

I'm trying to find a way to get the element properties of a network dataset (Number of edges, junctions, turns) using a python script. I understand that you can right click of the Network dataset and click on properties to get this info, but I need a way to automate this process. Is there a way to do this?

0 Kudos
7 Replies
DanPatterson_Retired
MVP Emeritus

arcpy exposes most of the network analyst extension... start there and here

0 Kudos
RachelAlbritton
Occasional Contributor III

Thanks for the suggestion Dan, but thats not exactly what I'm looking for. The links you sent were Network Analyst properties. I'm looking for Network Dataset properties. I've read through all this documentation, and unless I'm missing something it seems like you can get everything except for what I'm looking for. 

I see that you can get 'edgeSources' but I need to be able to get an actual Edge count from my network dataset.

0 Kudos
DanPatterson_Retired
MVP Emeritus

I guess you are saying then that one can't be calculated from the other... haven't looked at it in detail, but I would be suprised that there wasn't an indirect route

0 Kudos
MelindaMorang
Esri Regular Contributor

The number of network edges/junctions/turns is not available in python, unfortunately.  You could access it via ArcObjects if you were really desperate.  You can also count the number of features in the edge, junction, and turn source feature classes, but this isn't always a one-to-one mapping with the number in the network dataset because of your connectivity policy.

What is your ultimate goal in obtaining this information.  Maybe we can come up with a different way to achieve the same thing.

RachelAlbritton
Occasional Contributor III

Thanks Melinda.

Ultimately I'm looking for a way to double check if a network build is actually successful.  I have a script that runs every night and twice within the past 2 weeks the script reports that the build was successful but when I look at he network dataset properties in arcMap the build status isymbol set to "Not Built" and there are zero edges and junctions.I've done a bunch of tests with the script to make sure it's working the way it should, and by all accounts it does. We're thinking there might be something going on in the background on our network that would cause a false "successful build". So, if we had a property that the script could double check after the build is complete (like checking the build status or counting edges) I could re - evaluate how the script defines a successful build. 

0 Kudos
MelindaMorang
Esri Regular Contributor

Oh, I see.  So the real question is why your network sometimes isn't building successfully even though it says it is.  Are you getting build errors?  If so, the Build gp tool should return a warning message saying something like "Build succeeded with warnings" and give you a path to a text file containing the list of errors.  It would definitely be worth your investigating this file to see if that gives you any clues.  I'm pretty sure it's possible for the build to succeed but for there to be significant build errors such that most/all of the edges are missing.

RachelAlbritton
Occasional Contributor III

Thanks Melinda - I'm going to change our script to start incorporating build errors into the report out and see if that provides any clarity. 

0 Kudos