tags:

views:

1651

answers:

2

If I have a point, and a road network, how do I find the nearest point ON the road? i.e. this is like snapping the point to a line/road.

I am using ArcGis server 9.3 with Java 5 and Oracle 10g. I am using the ST functions and NetworkAnalyst via the java api.

Thanks.

A: 

The parts of the network should be created from lines or curves. Therefore, each its feature has to inherit the interface ICurve that implements method queryPointAndDistance(). Using that method and your point you should get nearest points on each feature you want to.

If you want to find out the nearest feature, you have to loop through the collection of the features (e.g. you have traced before) and compare distanceFromCurve parameters for each feature. See JavaDoc: http://resources.esri.com/help/9.3/arcgisengine/java/api/arcobjects/com/esri/arcgis/geometry/ICurve.html.

dond
A: 

Use INALocator.queryLocationBypoint(). You can create an NALocator from your NAContext. Pass in the point to the Locator and it will "snap" the point to the road network.

The URL button isn't working. Link to the JavaDoc is http://resources.esri.com/help/9.3/ArcGISengine/java/api/arcobjects/com/esri/arcgis/networkanalyst/INALocator.html#queryLocationByPoint(com.esri.arcgis.geometry.IPoint, com.esri.arcgis.networkanalyst.INALocation[], com.esri.arcgis.geometry.IPoint[], double[])

James Schek