AnsweredAssumed Answered

How to segment raster data?

Question asked by KarenSchulz_ on Oct 11, 2020
Latest reply on Oct 12, 2020 by KarenSchulz_

I am new to arcgis and appreciate any feedback and help =)


My aim: I would like to segment a raster image through the python api in the same manner as it is possible with the graphical interface.

 

My coding approach (using jupyter notebook), that didn't work##:


# import dependencies
import arcgis
from arcgis.gis import GIS
from arcgis.raster import Raster
from arcgis.raster.analytics import *

 

# set credentials

gis = GIS(<credentials>)

 

# load raster image, which is a tiff-file

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

 

# use segment function

segment(input_raster=raster_img)

# throws error:

AttributeError: '_ArcpyRaster' object has no attribute '_engine_obj'

Also tried using a different image from the online resources:
items2 = gis.content.search("title: multispectral landsat", item_type="Imagery Layer", outside_org=True)
landsat_layer = items2[0].layers[0]

This lead to a different error:

AttributeError: 'NoneType' object has no attribute 'update'

Outcomes