ArcObjects Library Reference

Load Network Locations Snippet

Loads network locations from a point feature cursor into a specified NAClass.

[C#]

///<summary>Loads network locations from a point feature cursor into a specified NAClass.</summary>
///  
///<param name="inputPointFeatureCursor">An ICursor interface that is the input point feature cursor.</param>
///<param name="naContext">An INAContext Interface that is the context that holds the NAClass to be loaded with network locations.</param>
///<param name="naClassName">A System.String that is the name of the NAClass to be loaded with network locations. Example: "stops".</param>
///  
///<returns>A System.Boolean that tells whether or not all input point features were successfully loaded = True or not = False.</returns>
public static System.Boolean LoadNetworkLocations(ESRI.ArcGIS.Geodatabase.ICursor inputPointFeatureCursor, ESRI.ArcGIS.NetworkAnalyst.INAContext naContext, System.String naClassName)
{
  ESRI.ArcGIS.NetworkAnalyst.INAClassLoader2 naClassLoader = new ESRI.ArcGIS.NetworkAnalyst.NAClassLoaderClass();
  naClassLoader.Initialize(naContext, naClassName, inputPointFeatureCursor);
  System.Int32 rowsIn = 0;
  System.Int32 rowsOut = 0;
  naClassLoader.Load(inputPointFeatureCursor, null, ref rowsIn, ref rowsOut);

  return (rowsOut == rowsIn);
}
[Visual Basic .NET]

'''<summary>Loads network locations from a point feature cursor into a specified NAClass.</summary>
'''  
'''<param name="inputPointFeatureCursor">An ICursor interface that is the input point feature cursor.</param>
'''<param name="naContext">An INAContext Interface that is the context that holds the NAClass to be loaded with network locations.</param>
'''<param name="naClassName">A System.String that is the name of the NAClass to be loaded with network locations. Example: "stops".</param>
'''  
'''<returns>A System.Boolean that tells whether or not all input point features were successfully loaded = True or not = False.</returns>
Public Shared Function LoadNetworkLocations(ByVal inputPointFeatureCursor As ESRI.ArcGIS.Geodatabase.ICursor, ByVal naContext As ESRI.ArcGIS.NetworkAnalyst.INAContext, ByVal naClassName As System.String) As System.Boolean

  Dim naClassLoader As ESRI.ArcGIS.NetworkAnalyst.INAClassLoader2 = New ESRI.ArcGIS.NetworkAnalyst.NAClassLoaderClass
  naClassLoader.Initialize(naContext, naClassName, inputPointFeatureCursor)
  Dim rowsIn As System.Int32 = 0
  Dim rowsOut As System.Int32 = 0
  naClassLoader.Load(inputPointFeatureCursor, Nothing, rowsIn, rowsOut)

  Return (rowsOut = rowsIn)

End Function


Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • ESRI.ArcGIS.Geodatabase
  • ESRI.ArcGIS.NetworkAnalyst
  • ESRI.ArcGIS.System