Merging Raster files

4394
13
05-16-2017 12:04 AM
AnanG
by
New Contributor II

I want to merge many landuse raster data. Each raster file has its own different kinds of landuse type. 

When I try to merge all of them (I have like 30+ raster files) the "Mosaic to New Raster" tool gives me an output with only 4 (the minimum number of unique values in one of the raster files) types of landuse file. 

I also tried using "Combine" tool with (< 20 files) but it didn't work.

How can I merge all the landuse raster files and also get 7 unique values in the final output?

0 Kudos
13 Replies
AnanG
by
New Contributor II

Hi again Dan 

I tried the "Mosaic to raster tool" for two files with different classes and it merged. The dark blue map shows the merged file (One file with 6 values; other 7)

As you can see here, the dark blue map shows two files merging despite the differences in values (one had 7; other had 6)

The problem is definitely with the gaps between the adjoining rasters. I tried to increase the pixel size for the raster which had gaps. But no matter how much I increase the pixel size, the gaps don't disappear. How do you suggest me to fix these gaps? 

Sorry for the inconvenience. I really appreciate your help. Thank you. 

0 Kudos
DanPatterson_Retired
MVP Emeritus

from the support pages, one method is to use an averaging approach

To: Remove and replace no data values within a raster using statistical information from the surrounding data values.

For version 10.0

1. In ArcMap, navigate to ArcToolbox > Spatial Analyst Tools > Map Algebra and open the Raster Calculator.

2. In Raster Calculator, input the following syntax: 
Code:
Con(IsNull("raster"), FocalStatistics("raster", NbrRectangle(5,5, "CELL"), "MEAN"), "raster")

Focal Statistics from help.... You might have to experiment a big.  BUT!!! get everything together and quit playing around with the cell size to try and close the gaps...it does NOT work that way

AnanG
by
New Contributor II

Hi again,

Thank you for the help Dan!

I used the "Raster Calculator" and it gave me something like this. Something still seems wrong though (see the red box). Maybe my focal mean values are still smaller for that file. Moreover, it does not have any attribute table which would show the number of pixels for each landuse type. What do I do now? Sorry for troubling you so much. I feel like I am getting closer to the solution so I can't help but ask you  

0 Kudos
DanPatterson_Retired
MVP Emeritus

use the equivalent tools from Arctoolbox since you have better control over the analysis properties in the Environments tab for every arctoolbox tool.  The raster calculator is nice... but get used to using the actual tools.

You do the focal statistic when the whole area is merged together... AND... if you do the mean you will end up with a floating point raster.  Do the majority or something so that you get an integer raster to maintain your integer classes!

The whole purpose of the venture is to get rid of the gaps at the edges while maintaining the input data type.  Don't lose sight of the important bits as you go along.