I have 2 rasters, one representing land-cover and 1 representing trails and roads. I want to use the con function in ArcMap so that my new raster will contain both but the unclassified or wrongly classified pixels on the landcover for roads will be replaced due to the trails/roads raster layer.

I have read the documentation but dont fully understand which raster layer is the input conditional and which is the input true raster? Or how to construct the query? I know what i want to say in english but I dont know how to write it in SQL.


Con expression must be logical. Either your create a bianry raster with values of 1/0 or you write the query (condition, value if true, value if false).

In your case, this will be

Con(("raster_road" == 1) | ("raster_road" == 2), "raster_road", "raster_land_cover")

where | is the logical "or" and & would be the logical "and" (if needed)

Note that if you have NoData values in your road raster, then you need to handle it specifically, e.g.

Con(IsNull("raster_road"),"raster_land_cover", "raster_road")  
  • My roads raster has been classified as value 1 = trails and value 2 = roads – Joshosh Aug 29 '16 at 13:11
  • and what about the bacground value ? – radouxju Aug 29 '16 at 13:13
  • It is a classified image from ENVI and doesnt have an attributes table to be viewed – Joshosh Aug 29 '16 at 13:14
  • you can check background value with identify tool. If it is noData and you do not use my second option, then the result will be NoData even if there are valid pixels in the other raster. – radouxju Aug 29 '16 at 13:17
  • If i have both rasters open and use the identify tool, anything which isnt a road or trail shows NoData – Joshosh Aug 29 '16 at 13:18

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.