AnsweredAssumed Answered

ClassifyRaster() Function not working

Question asked by KarenSchulz_ on Oct 12, 2020
Latest reply on Oct 13, 2020 by danretired

The function

arcpy.sa.Functions.ClassifyRaster(in_raster, in_classifier_definition, in_additional_raster='#')

is giving me the error RuntimeError: Object: Error in executing tool.

 

I set up the example analogue to Raster klassifizieren—Hilfe | ArcGIS for Desktop .

You can see the code in the following:

 

import arcgis
from arcgis.gis import GIS
from arcgis.raster import Raster

import arcpy
from arcpy.sa import *

from arcgis.raster.functions import *
from arcgis.raster.analytics import *

arcpy.CheckOutExtension("Spatial")

 

file_path = r"<path>.tif"
raster_test = Raster(file_path)

test_img = segment_mean_shift(raster_test, spectral_detail=None, spatial_detail=None, spectral_radius=None, spatial_radius=None, min_num_pixels_per_segment=None)

# file generated through graphical interface, because python code is not working as well

ecd_file = f"<path>/Preview_Segmented_TrainIsoCl.ecd"

ClassifyRaster(in_raster=test_img, in_classifier_definition=ecd_file)

 

I appreciate any help in solving this issue =)

Outcomes