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


INALocator.QueryLocationByPoint Method (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > NetworkAnalyst > ESRI.ArcGIS.NetworkAnalyst > Interfaces > IN > INALocator Interface > INALocator.QueryLocationByPoint Method
ArcGIS Developer Help

INALocator.QueryLocationByPoint Method

Use the locator agents to find a network location from a point.

[Visual Basic .NET]
Public Sub QueryLocationByPoint ( _
    ByVal Point As IPoint, _
    ByRef Location As INALocation, _
    ByRef outPoint As IPoint, _
    ByRef distanceFromPoint As Double _
)
[C#]
public void QueryLocationByPoint (
    IPoint Point,
    ref INALocation Location,
    ref IPoint outPoint,
    ref double distanceFromPoint
);
[C++]
HRESULT QueryLocationByPoint(
  IPoint* Point,
  INALocation** Location,
  IPoint** outPoint,
  System.Double* distanceFromPoint
);
[C++]
Parameters
Point [in]

Point is a parameter of type IPoint* Location [in, out]
Location is a parameter of type INALocation** outPoint [in, out]
outPoint is a parameter of type IPoint** distanceFromPoint [in, out]
distanceFromPoint is a parameter of type double*

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server. Requires Network Analyst Extension.

Remarks

Using the input Point object, this method calls QueryLocationByPoint on each of its associated NALocatorAgent classes.   The corresponding NALocation, the point where the location was found, and the distance from the input point to the source feature found are all returned.

Generally, the NALocator used for this method should be retrieved from a NAContext.  However, if you do create a NALocator, or have added a new locator agent, then, before querying the NALocator, Bind should be called on the NALocator to set up the locator agents and associate it with the NetworkDataset.

QueryLocationByPoint searches for network locations based upon an input point.  When the NALocatorFeatureAgent is used, the distance returned is from the point to the feature, not from the point to the actual network location on the feature. It is important to know the distance to the feature as a whole because this is the feature on which you want to locate the endpoint/midpoint.  If you need to determine the distance from the input point to the actual network location point, use IProximityOperator::ReturnDistance between the input point and the output point.

If FindClosestAmongAllAgents is false, it will return after the first locator succeeds in finding a location.

The output geometry is returned in the spatial reference of the network dataset.  Optionally, set an OutputSpatialReference on the NALocator.

See Also

INALocator Interface