Ticket #391 (closed Defect: fixed)
On ArcGIS 9.2, Find Nearest Features fails with the message "Near Features: Value is not valid. Invalid feature class type"
|Reported by:||jjr8||Owned by:||jjr8|
|Component:||Tools - Spatial Analysis||Version:|
The logging output looks like this:
Executing (Find Nearest Features): ArcGISPointsFindNearestFeatures C:\TestFindNearestFeatures\Points.shp C:\TestFindNearestFeatures\Polygons_Empty.shp # PolyID # # Zero # # # # "Updated point features" Start Time: Wed Nov 04 11:10:04 2009 Running script ArcGISPointsFindNearestFeatures... Copying the points. The near feature class C:\TestFindNearestFeatures\Polygons_Empty.shp is empty. All points will be updated with NULL values (or the equivalent). Failed to execute. Parameters are not valid. Near Features: Value is not valid. Invalid feature class type Failed to execute (Near). ArcGISError: An ArcGIS geoprocessing function failed. This usually results from a problem with your inputs. Please check them and try again. Also review any preceding error messages and the detailed error information that appears at the end of this message. If you suspect the failure is due to a programming mistake in this tool or ArcGIS, please contact the author of this tool for assistance. Detailed error information: ArcGIS Geoprocessor object 0x00A4E120: Invocation of Near_analysis(*args=('C:\\Temp\\GeoEcoTemp_Jason\\tmpuwp0ik\\Temp.mdb\\CopiedPoints', 'TempLayer74E4412C', '', 'NO_LOCATION', 'NO_ANGLE')) raised RuntimeError: Failed to execute. Parameters are not valid. Near Features: Value is not valid. Invalid feature class type Failed to execute (Near). Error in script ArcGISPointsFindNearestFeatures. Error in executing: cmd.exe /C C:\PROGRA~1\GeoEco\ARCGIS~1\Scripts\AR5FE0~1.PY "C:\TestFindNearestFeatures\Points.shp" "C:\TestFindNearestFeatures\Polygons_Empty.shp" "#" "PolyID" "#" "#" "Zero" "#" "#" "#" "#" "Updated point features" Failed to execute (Find Nearest Features). End Time: Wed Nov 04 11:12:44 2009 (Elapsed Time: 2 minutes 40 seconds)
The problem occurs when the near features are empty, or the Near Features Where Clause selects 0 near features. Even though there are no near features, the current implementation calls ArcGIS's Near_analysis tool anyway. On ArcGIS 9.3, this works fine, but it fails on 9.2. I did not catch this in my 9.2 testing of this tool.
The code should be changed to not call Near_analysis if there are no near features.
Thanks to ZuZu Gadallah for reporting this problem.