Quantcast
Channel: Forums - ArcObjects SDKs
Viewing all articles
Browse latest Browse all 1374

How to use the NEAR Class: the basics ?

$
0
0
(This post was sent in the geoprocessing forum, but I moved it here)

I'm using the Java SDK in Eclipse.

I want to determine the distance between a point (in a first shapefile) and the nearest point amongs a set of many points (in a second shapefile).

For this purpose, I use the Near Class, but my simple code contain an error (see below). The shapefiles that I use have successfully been used in the Buffer Class in another code, so it seems that I dont use the NEAR class correctly.

I would appreciate if you could explain how the NEAR class should be used.

I'm using these lines of code:

//// Java code begins here

// Create a Near object, with both input shapefiles in the constructor
Near near = new Near("D:\\myPosition.shp","D:\\myManyPositions.shp");

// Create a geoprocessor and execute the Near object
GeoProcessor gp = new GeoProcessor();
IGeoProcessorResult result1 = gp.execute(near, null);

//// Java code ends here

Viewing all articles
Browse latest Browse all 1374

Trending Articles