frmap1

Using "Near" with Java SDK

Discussion created by frmap1 on Mar 29, 2013
I'm using the Java SDK.

I want to determines the distance from a point (defined in an input shapefile) to the nearest point amongs many points (in another shapefile).

Unfortunately, these 3 lines of code contain an error, and I cannot find the error. However, the same shapefiles used in the function BUFFER works well, 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

Outcomes