0

I am trying to create a binary raster using the Raster Calculator in ArcGIS 10.2. I have a raster with ~20 different values, but I'm only interested in cells where the value = 10. I've been using the conditional argument, but I think there might be a problem with my variables having text associated with them; I keep getting "Error 000539: Runtime error Syntax Error: Keyword can't be an expression."

I've used the following:
Con("InputRaster" = 10, 1, 0)

This didn't specify where the variable values were, so I tried:
Con("InputRaster", "Value" = 10, 1, 0)

And then I tried enclosing the argument:
Con("InputRaster", '"Value" = 10', 1, 0)

In all instances, I received the exact same error message. In the "value" column in my attribute table, only numbers are listed, not text, so there shouldn't be an issue with non-numeric values. The associated text only appears in the table of contents, next to the numeric value.

Any thoughts on how to fix my equation?

0

1 Answer 1

2

I think you might need to use a double = sign, as this finally worked for me:

Con("%InputRaster%" == 1, 99, 0)

Make sure also the InputRaster is the actual name of the output and not the name of the model element... raster calculator seems to want the name of the dataset on disk.

3
  • @KKL234 no problem - but for what it's worth there is no mention of using == on the ArcGIS help docs...which is strange... glad I could help!!! Commented Jan 29, 2015 at 16:46
  • Handy help page for Map Algebra operators (including '=='): resources.arcgis.com/en/help/main/10.2/index.html#//…
    – phloem
    Commented Jan 29, 2015 at 22:09
  • thanks @phloem! Weird how all the examples show the use of = but the correct syntax is == !!! Commented Jan 29, 2015 at 22:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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