How to merge raster files in ArcGIS?

120679
6
04-01-2010 09:40 PM
HaoHuang
New Contributor
I tried merge function from Map algebra in the Spatial Analysis Toolbox, but doesn't work. who kow how to deal with it? Thanks a lot....
0 Kudos
6 Replies
CrystalDorn
New Contributor III
Without more details or a description of the error you received it's not possible to comment, for example, I assume you are using the Single Output Map Algebra tool

In the meantime, start with:
Your Toolbox ENVIRONMENT settings, e.g. input projections and processing output projections, path to output workspace?, etc.

Have you tried to use the Mosaic to New Raster tool?
JakubSisak
Occasional Contributor III
ArcToolbox -> Data Management Tools -> Raster -> Raster Dataset -> Mosaic To New Raster
AsparuhKamburov
New Contributor
ArcToolbox -> Data Management Tools -> Raster -> Raster Dataset -> Mosaic To New Raster


Yep, that works fine. Thanks a lot!
0 Kudos
ToddMacPherson
New Contributor II
Thanks for this. An oldie but a goodie.
0 Kudos
curtvprice
MVP Esteemed Contributor

The real oldie and goody is merge(), which with "real" Con was removed at 10.0. (Though the rough edges of the Mosaic tool have been smoothed a bit (haha).  Mosaic, being a core raster tool, is not integrated in arcpy map algebra, which is a pity.

More map-algebra friendly replacements for the old (missing) merge function include:

- CellStatistics with the "DATA" parameter, using an appropriate statistics choice in case there is overlap (For example - "MAXIMUM" or "MEAN")

CellStatistics([raster1, raster2, raster3], "MEAN", "NODATA")

- Use Con and IsNull to get the first in the list that is non-NoData

Con(^ IsNull(raster1), raster1, Con(^ IsNull(raster2), raster2)))
Con(^ IsNull(raster1), raster1, Con(^ IsNull(raster2), raster2, Con(^ IsNull(raster3), raster3)))

- You can still use SOMA (this is only supported for backwards compatibility).

expr = "merge({0}".format(",".join[str(r) for r in [raster1, raster2, raster3]])
tmpras  = arcpy.CreateScratchName("","","raster")
outras = Raster(arcpy.gp.SingleOutputMapAlgebra_sa(expr,  tmpras))

Please join me and vote this up!

ideas.arcgis.com: Bring back Spatial Analyst Merge tool

UPDATE: I have posted an arcpy map algebra implementation of the old merge() functionality.

Implementing merge() in ArcPy map algebra

StephenJordan2
New Contributor

Hey Guys, thanks for all your help I actually used the Extract by Attributes tool SQL query Where "Rowid" =1 in the end.

all done and looking good now

0 Kudos