How to concatenate raster images in one representing value?

3546
17
Jump to solution
08-11-2017 08:24 AM
AshrafAfana
New Contributor II

Hi all, 

I'm trying to concatenate the values of two raster images in order to have a value that includes both of them (e.g. 02 + 07 = 0207). I'm trying to use the following in Raster Calculator "image1" & "" & "image2" but with no success. 

any suggestions?

0 Kudos
17 Replies
DanPatterson_Retired
MVP Emeritus

way too much overkill for a preceeding zero

far easier to edit the legend

curtvprice
MVP Esteemed Contributor

May be overkill - this depends on how many unique combinations my friend!

0 Kudos
AshrafAfana
New Contributor II

This is a tricky but genius answer and it solves the problem in a handy way. To be honest, I coded the process in python and it works for as many combination as you'd like. Thanks Curtis.

Ashraf

0 Kudos
AlysKarimi
New Contributor

Hi Ashraf,

I have a similar issue with concatenating Fields of rasters in ArcMap. I combined 2 rasters to get a raster with both Fields from the 2. Then I concatenated the text Fields as per the suggestions above. The result is fine. But the problem with this raster is that when I apply Raster Calculator, it does not work on the joint fields, and it only works on the Value and Count fields. I was thinking you might have encountered the same issue and could give me some advice.

Cheers.

0 Kudos
curtvprice
MVP Esteemed Contributor

You can access raster fields using the Lookup tool. Not so sure you can apply Raster Calculator on text values however.

AlysKarimi
New Contributor

Thanks Curtis. 

That's actually really helpful. I did not know about this tool at all. But I am wondering wouldn't the "join from a table" do the same thing?

0 Kudos
curtvprice
MVP Esteemed Contributor

But I am wondering wouldn't the "join from a table" do the same thing?

Lookup is the way to access fields in raster attribute tables that are not value. In 9.x the syntax for this was 'raster.field'  (eg 'raster.COUNT') this is now in map algebra expressed as Lookup(raster, "COUNT")  If you have a active join from the raster table to another table, you can use that in the Lookup expression with the fully qualified field name in the joined table: Lookup(raster, "othertable.field")

Again in map algebra expressions must resolve to a numeric value -- you can't use map algebra to combine raster table text fields. The best you can do to combine text fields from multiple raster inputs is do a Combine, add a new text field to the Combine output raster table, add a join back to the inputs using Add Join and run Calculate Field to populate the new field from calculations using the fully-qualified related field names.

AlysKarimi
New Contributor

Great. Thanks very much. Problem resolved. 

0 Kudos