1

I want to create Countour Lines for a DEM which are based on a "STD dev" classificaion. My problem is that the "Std dev" is exported in an unknown type instead of a String. So the classifacation for the Contour Tool can not be executed.

Do you have any ideas how i could convert it in a String?

STD

elevstd=arcpy.GetRasterProperties_management("rectExtract","STD")

Define Variables

Intervall=0  
Automatisch=0

If Statements

if Intervall==Automatisch and elevstd>"0" and elevstd<="5":   # Class1  
    Contour("rectExtract", "C:/fakepath/Class1.shp", 1,0)  
if Intervall==Automatisch and elevstd>"5" and elevstd<="10":  # Class2  
    Contour("rectExtract", "C:/fakepath/Class2.shp", 5,0)  

Thanks for your help,

2

I don't know why, but some tools return a Result object instead of the actual result. From the help on Get Raster Properties:

The Python result of this tool returns a geoprocessing Result object. In order to obtain the string value, use the Result object's getOutput method.

So you can grab the result like so, casting it to str() since it returns unicode:

elevstd = str(arcpy.GetRasterProperties_management("rectExtract","STD").getOutput(0))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.