I am combining many rasters using a "barcode" that describes attributes for each cell. Combine works on integer values: I combine multiple layers using "combine" tool, then create the bar code by creating a new field (text) and concatenating using the "&" to link fields. The next step is to combine a set of barcodes. But since the bar codes are in a field of type text, "combine" tool will not recognize them. If I copy the barcode values into a field of long integer type, my zeroes create problems. 0000010 becomes 10. I could "trick" the integer field by substituting some other integer for zero. It would perhaps be confusing for the user but it might work. Is there another tool that will combine rasters and keep fields of type text?

  • Welcome on GIS SE. What software are you using? – MrXsquared Jan 9 '19 at 22:38
  • Oops! Sorry: ArcGIS Desktop 10.6.1. The route I am taking now is to change my text fields to integer values through the "reclassify" tool. It is tedious, I have ten layers, each with about 19 classes, to edit, but it looks like it will work. – TobyG Jan 9 '19 at 23:07
  • This is trivial in Python or R, so I feel like it should be in ArcGIS but I don't use Arc so I don't know. Can you not use the raster calculator? – Jon Jan 9 '19 at 23:50
  • If you can combine as an integer 0000010 becomes 10 then build raster attribute table, add a text field and calculate in python str(barcode).zfill(7) to pad with leading zeros to 7 characters. – Michael Stimson Jan 10 '19 at 0:01
  • Thank you for the comments. I don't think raster calculator works on multiple fields. I could make 10 copies of my set of rasters, reduce each one to the one of the seven elements of the code, combine each in raster calculator, then combine again on those values. Or use Michael's suggestion, but I would need an if, elseif clause because not all barcodes begin with zero. I need to think about this some more but these suggestions are helping. – TobyG Jan 10 '19 at 19:36

Your Answer

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

Browse other questions tagged or ask your own question.