This document is archived and information here might be outdated.  Recommended version.


IPointToEID Interface (ArcObjects .NET 10.6 SDK)
ArcObjects Help for .NET developers > ArcObjects namespaces > NetworkAnalysis > ESRI.ArcGIS.NetworkAnalysis > Interfaces > IP > IPointToEID Interface (ArcObjects .NET 10.6 SDK)
ArcObjects Library Reference (NetworkAnalysis)  

IPointToEID Interface

Provides access to members that find the nearest network element to a given point.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

When To Use

Use the methods on IPointToEID to find the nearest network element to a given point in the map.

Members

Name Description
Write-only property GeometricNetwork Source geometric network from which the result EID will come.
Method GetNearestEdge Returns the edge EID nearest to the input point, the physical point location that corresponds to the EID, and the percentage along that EID.
Method GetNearestJunction Returns the junction EID nearest to the input point, and the physical point location that corresponds to the EID.
Write-only property SnapTolerance Maximum distance from the input point to an acceptable EID.
Write-only property SourceMap Source map in which to search for the nearest EID.

CoClasses that implement IPointToEID

CoClasses and Classes Description
PointToEID A container for finding the nearest network element ID to a given point.
[C#]

The following code can be used to place a junction flag on the nearest junction feature to the given (x,y) map coordinate.  It assumes you have a reference to the source map in the map variable, a reference to the Network Analysis Extension in the networkAnalysisExt variable, and the flag symbol in the symbol variable.

  // convert the (x,y) map coordinate to a new Point object
  IPoint point=new PointClass() as IPoint;
  point.X=x;
  point.Y=y;
  
// find the nearest junction element to this Point int EID;
IPoint outPoint; IPointToEID pointToEID=new PointToEIDClass() as IPointToEID; pointToEID.GeometricNetwork=networkAnalysisExt.CurrentNetwork; pointToEID.SourceMap=map; pointToEID.SnapTolerance=10; // set a snap tolerance of 10 map units pointToEID.GetNearestJunction(point, out EID, out outPoint);

// convert the EID to a feature class ID, feature ID, and sub ID
INetElements netElements=networkAnalysisExt.CurrentNetwork.Network as INetElements;
int FCID, FID, subID; netElements.QueryIDs(EID, esriETJunction, out FCID, out FID, out subID);


// create a new JunctionFlagDisplay object and populate it
IJunctionFlagDisplay junctionFlagDisplay=new JunctionFlagDisplayClass() as IJunctionFlagDisplay;
IFlagDisplay flagDisplay=junctionFlagDisplay as IFlagDisplay;
flagDisplay.FeatureClassID=FCID;
flagDisplay.FID=FID;
flagDisplay.SubID=subID;
flagDisplay.Geometry=outPoint as IGeometry;
flagDisplay.Symbol=symbol as ISymbol;

// add the JunctionFlagDisplay object to the Network Analysis extension
INetworkAnalysisExtFlags networkAnalysisExtFlags=networkAnalysisExt as INetworkAnalysisExtFlags;
networkAnalysisExtFlags.AddJunctionFlag(junctionFlagDisplay);
[Visual Basic .NET]

The following code can be used to place a junction flag on the nearest junction feature to the given (x,y) map coordinate.  It assumes you have a reference to the source map in the map variable, a reference to the Network Analysis Extension in the networkAnalysisExt variable, and the flag symbol in the symbol variable.

  ' convert the (x,y) map coordinate to a new Point object
  Dim point As IPoint=New Point
  point.X=x
  point.Y=y
  
' find the nearest junction element to this Point Dim EID As Integer
Dim outPoint As IPoint Dim pointToEID As IPointToEID=New PointToEID With pointToEID .GeometricNetwork=networkAnalysisExt.CurrentNetwork .SourceMap=map .SnapTolerance=10 ' set a snap tolerance of 10 map units .GetNearestJunction(point, EID, outPoint) End With


' convert the EID to a feature class ID, feature ID, and sub ID
Dim netElements As INetElements=CType(networkAnalysisExt.CurrentNetwork.Network, INetElements)
Dim FCID As Integer, FID As Integer, subID As Integer netElements.QueryIDs(EID, esriETJunction, FCID, FID, subID)


' create a new JunctionFlagDisplay object and populate it
Dim junctionFlagDisplay As IJunctionFlagDisplay=New JunctionFlagDisplay
Dim flagDisplay As IFlagDisplay=CType(junctionFlagDisplay, IFlagDisplay)
With flagDisplay
.FeatureClassID=FCID
.FID=FID
.SubID=subID
.Geometry=CType(outPoint, IGeometry)
.Symbol=CType(symbol, ISymbol)
End With

' add the JunctionFlagDisplay object to the Network Analysis extension
Dim networkAnalysisExtFlags As INetworkAnalysisExtFlags=CType(networkAnalysisExt, INetworkAnalysisExtFlags)
networkAnalysisExtFlags.AddJunctionFlag(junctionFlagDisplay)

.NET Related Topics

NetworkAnalysis