ValidateNetworkTopology in CoreHost

318
3
04-14-2023 11:38 AM
JoeHershman
MVP Regular Contributor

We have an application that places a Tee and an attached service line (in gas) in a UN.  That part seems to work as expected.  The problem is trying to validate the topology afterwards. This seems like a pretty simple task simply call ValidateNetworkTopology Method 

According to documentation this should not be wrapped in an edit operation.  Unfortunately this does not seem to work.  If I try this way, to first expand the envelope

public ValidationResult ValidateTopology(UtilityNetwork utilityNetwork, Geometry serviceGeometry)
{
	//expand the area used for validation
	Envelope envelope = serviceGeometry.Extent.Expand(1.05, 1.05, true);

	ValidationResult result = utilityNetwork.ValidateNetworkTopology(envelope);
}

The following exception is received

ArcGIS.Core.Data.GeodatabaseEnterpriseException: The specified coordinate exceeds the valid coordinate range. ---> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x80041590
at ArcGIS.Core.Internal.IUtilityNetworkIOP.UtilityNetwork_ValidateNetworkTopology(IntPtr utilityNetworkHandle, IntPtr extentHandle, Boolean useAsynchronousService, DateTime& timeStamp, Boolean& hasErrors, Int32& dirtyAreasCount, Boolean& isFullUpdate)
at ArcGIS.Core.Data.UtilityNetwork.UtilityNetwork.ValidateNetworkTopologyInternal(Geometry extent, InvocationTarget invocationTarget)
--- End of inner exception stack trace ---

If instead of using the slightly expanded envelope, the service line geometry is sent the method simply times out.  No exception is received

Seems pretty straight forward, not sure what is incorrect

 Thanks

 

Thanks,
-Joe
0 Kudos
3 Replies
RichRuh
Esri Regular Contributor

Hi Joe,

This should be a simple task, and I cannot see anything wrong with the code you have provided. 

Do you have access to fiddler? Could you compare the REST request packet between this call and a call to validate generated in Pro (using a similar feature)?  In particular, are the extent coordinates similar?  The only thing I can think of is that the coordinates you are passing in are using a different spatial reference than the utility network...

--Rich

JoeHershman
MVP Regular Contributor

There is something really odd with M and these shapes, see my earlier post.  Investigating the shapes when passed in have M values at like int.Max or something.  So I just take the same X, Y extents and SR and use that to build a new Envelope.  Then use that in the ValidateNetworkTopology method and it works

Thanks,
-Joe
0 Kudos
RichRuh
Esri Regular Contributor

Glad to hear it, Joe. Good luck figuring out the M issues.

Take care,

--Rich

0 Kudos