Editing Raster Pixels with the Con Tool

3059
6
Jump to solution
07-13-2015 10:06 AM
AndreKrimbacher
New Contributor II

Hi,

I've got a digital surface model with several false values below zero. So what I'm trying to do is replace all negative values with zero.

I've tried using the followng raster calculator expression:

Con("myraster" > 0, "myraster", 0)

In theory this should keep all values which are >0 and replace all others with 0. However, all I get is an unspecified error message.

I've also tried using the Con Tool itself but the result is the same. Any ideas what I'm doing wrong?

0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Emeritus

Can you open the Results window and examine the contents of the messages etc.  Look for paths with spaces or other unsavory characters, filenames that are too long contain spaces etc and any general information that you can share.  The unspecified nature of the error is usually not one of syntax but one of naming conventions and file locations.  Also it is a good practice to ensure that there is a space between grid names, operands and spaces.  The access and results window should provide a basis for what has or hasn't worked.

Results_window.png

View solution in original post

6 Replies
JayantaPoddar
MVP Esteemed Contributor

Andre,

Try an additional parenthesis ()

Con(("myraster" > 0), "myraster", 0)



Think Location
0 Kudos
DanPatterson_Retired
MVP Emeritus

Can you open the Results window and examine the contents of the messages etc.  Look for paths with spaces or other unsavory characters, filenames that are too long contain spaces etc and any general information that you can share.  The unspecified nature of the error is usually not one of syntax but one of naming conventions and file locations.  Also it is a good practice to ensure that there is a space between grid names, operands and spaces.  The access and results window should provide a basis for what has or hasn't worked.

Results_window.png

AndreKrimbacher
New Contributor II

Thanks, that helped. I've checked all the paths and found the problem. Now it works.

0 Kudos
DanPatterson_Retired
MVP Emeritus

for closure...what was the problem?

0 Kudos
AndreKrimbacher
New Contributor II

A space in the folder name.

DarrenWiens2
MVP Honored Contributor

Have you since restarted ArcMap? I've received "Error 99999" many times with correct syntax, only for it to work upon restart. For the record, your original syntax is valid (just tested).

0 Kudos