Identify if feature set is coincident with network features for trace in script tool

2223
5
06-05-2013 09:38 AM
ChristinaKellum
New Contributor III
I have a script tool that uses the Trace Geometric Network tool with a feature set as flags to allow user defined flags.  I use the Snap_edit to make the flags coincident with the network features.

I want to be able to tell the user in a message through validation if their flag is not coincident with the network, instead of the tool failing while the trace is performed and gives  a " ERROR 001191: No flag found from the flag junction feature class".

What's the best way to identify if the feature set is coincident with network features within the tool validation?  How can you tell if the SNAP_EDIT actually snapped to anything?

In an ideal world, the flag would not be allowed if it wasn't coincident (like the add-in tool).

Thanks in advance.
Tags (2)
0 Kudos
5 Replies
RobertBorchert
Frequent Contributor III
Curious.

You should not be able to place flags except on the network. Do you have multiple networks in your instance?

I just tried it to make sure and it is only allowing flags to go direct onto a network feature.

If you have multiple networks active you need to select from the drop down menu which network you are trying to place the flag on.

I have a script tool that uses the Trace Geometric Network tool with a feature set as flags to allow user defined flags.  I use the Snap_edit to make the flags coincident with the network features.

I want to be able to tell the user in a message through validation if their flag is not coincident with the network, instead of the tool failing while the trace is performed and gives  a " ERROR 001191: No flag found from the flag junction feature class".

What's the best way to identify if the feature set is coincident with network features within the tool validation?  How can you tell if the SNAP_EDIT actually snapped to anything?

In an ideal world, the flag would not be allowed if it wasn't coincident (like the add-in tool).

Thanks in advance.
0 Kudos
ChristinaKellum
New Contributor III
This is not using the Utility Network Toolbar, but creating a python script tool using the TraceGeometricNetwork in arcpy.  I would like for my feature set to function like the toolbar, not allowing you to to create a flag unless it's on the network.
0 Kudos
ChrisSnyder
Regular Contributor III
How about just some derivation of SelectByLocation as part of the validation? As in if the featureset point "INTERSECT" your network, then you are good to go. This post: http://forums.arcgis.com/threads/35323-ArcPy-amp-SelectLayerByLocation-Performance?p=119305&viewfull... might give you some ideas to make the SelectByLocation be more efficient.

Also, when your users create the points in your featureset in v10.0 +, the "auto snapping" should be turned on (unless you have "traditional snapping" turned on), so using the snap_edit tool might be redundant, but maybe not.

P.S. Shouldn't you be 461 or something?
0 Kudos
ChristinaKellum
New Contributor III
Thanks for the ideas...I'll let you know how it works.

Do you know if you can obtain the results from the SNAP_EDIT, like it snaped x number of features...?  If I run the snap tool it'll tell me that it ran successfully even if nothing snapped.

Good question about the auto-snapping.  Since the snapping is dependent on the user's settings, (snaps to point, edge etc, or they turn snapping off) I wanted to have it in the code as a just-in-case their snapping env isn't what it should be...

I might try to validate if the point/s are within x feet from network, throw an error if they are not, and snap if they are.  something like that.

ps can't change my login... I'll forever be ckel490 to ESRI
0 Kudos
ChrisSnyder
Regular Contributor III
Do you know if you can obtain the results from the SNAP_EDIT, like it snaped x number of features...?
 

I suspect there isn't a direct way to do this... I would think you would have to inspect the geometry to see what changed. Maybe there is something in the result object though, but I doubt it.

You'll always be a 490 to me...
0 Kudos