Create raster from multiple .asc rasters

2249
4
Jump to solution
04-17-2021 07:28 PM
Labels (2)
GlenShennan
New Contributor III

I am trying to load ~2000 rasters stored as .asc files and merge them into one raster. The Copy to Raster tool doesn't seem to recognise them (they don't appear in the browser when I load the tool) and neither does the Add Data tool. I can see them in the catalog and load them into the map that way but dealing with that many layers is extremely difficult.

Can anyone suggest an approach for an efficient (as in my time) way to merge that many ASCII rasters into one layer (I'm thinking TIFF) and load them into my geodatabase? I've been exploring the Create Raster Dataset and Mosaic to New Raster tools but just can't work out exactly what I should be doing.

As always thanks in advance.

P.S. I have a feeling that ArcPy is going to be the way to go and I've been trying that too but I'm new to ArcPy I'm not really sure which tools to use. Comfortable with Python though.

0 Kudos
1 Solution

Accepted Solutions
curtvprice
MVP Esteemed Contributor

I just tried this with Pro 2.7.2 and Pro recognized the .asc files just fine (both in the Catalog pane and in the Copy Raster tool dialog).  What version are you using?

If there are 2000 of them, you may want to convert to .tif and then consider create a mosaic dataset, then maybe Copy Raster to convert that to a single massive gdb raster or tiff.

If you are familiar with python, just get the syntax of the Copy Raster tool by running it once, right clicking on the geoprocessing history for the tool and copy with python snippet, and paste into python and write a loop around it, sticking your loop variables in it.

Try this test raster to see if the problem is your data set (save as "test.asc")

 

 

NCOLS 5
NROWS 5
XLLCORNER 0
YLLCORNER 0
CELLSIZE 1
NODATA_VALUE 0
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1

 

 

View solution in original post

4 Replies
DanPatterson
MVP Esteemed Contributor

Although deprecated, did you look at

ASCII To Raster (Conversion)—ArcGIS Pro | Documentation

if Copy Raster isn't seeing the .asc file extension

 

Addendum

I remember this protracted discussion before.

Problems with ASCII to Raster in ArcGIS Pro 2.6.x - Page 2 - Esri Community

I haven't had issues, but at least one thread, and there was a bug associated with the header not being read if it were in capitals.  It should be fixed, but it was never marked resolved.


... sort of retired...
GlenShennan
New Contributor III

ASCII to Raster doesn't appear to be in ArcPro 2.7. Checked the headers, all lower case. 😕

0 Kudos
curtvprice
MVP Esteemed Contributor

I just tried this with Pro 2.7.2 and Pro recognized the .asc files just fine (both in the Catalog pane and in the Copy Raster tool dialog).  What version are you using?

If there are 2000 of them, you may want to convert to .tif and then consider create a mosaic dataset, then maybe Copy Raster to convert that to a single massive gdb raster or tiff.

If you are familiar with python, just get the syntax of the Copy Raster tool by running it once, right clicking on the geoprocessing history for the tool and copy with python snippet, and paste into python and write a loop around it, sticking your loop variables in it.

Try this test raster to see if the problem is your data set (save as "test.asc")

 

 

NCOLS 5
NROWS 5
XLLCORNER 0
YLLCORNER 0
CELLSIZE 1
NODATA_VALUE 0
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1

 

 

GlenShennan
New Contributor III

Ah, thanks! I saved your test data as 'test.asc' but Copy Raster still didn't see it. Your data has all caps in the header whereas mine is all lower case so I don't think that's the problem.

I used your trick to get the Copy Raster Python syntax and it works! I haven't got it all finished but that's a great start. Thanks.

0 Kudos