Slicing ArcGIS ASC files into tiles


There are times that you want to slice an ArcGIS RASTER file stored in ASC format into some smaller tiles. This could be due to lack of enough memory, or if you want to perform an operation, such as calculating area solar radiation, on a smaller region of your data set.

One solution is to mask a portion of your data. However, if you want to systematically break your data into bunch of smaller non-overlapping  tiles, it is better to have a program that does it for you automatically. You can still do this manually, probably you need a spreadsheet program, to calculate the coordinates of the lower left corner of all the tiles, and you have to adjust for the number of rows and columns that you need to add to make the ncols and nrows divisible by the number of tiles that you want in each directions. Then you need to go to ArcGIS, and key in all those numbers one by one.

Let say you want to break your data into a 3 by 2 tiles. There are 6 tiles in total. But what if there are 30 by 20 tiles. there are 600 tiles now. Well, now you need a script.

The script is called slice_asc_Platforms, where platforms is mac, win, or linux. The command prompt tool is easy to use:

 slice_asc_[mac,win,linux] InputFile nH nV Output 

where:

  • “InputFile” is, well, the  the input file, i.e. ArcGIS ASC RASTER file,
  • nH is the number of tiles in the horizontal direction, i.e. longitudinal,
  • nV is the number of tiles in the vertical direction, i.e. latitudinal,
  • and “Output” is used in naming the output files.

The out files are named using “Output_hXXXXX_vYYYYY.asc” where XXXXX and YYYYY are the tile number in horizontal and vertical. So the tile (3,4) would be Output_h00003_v00004.asc and so on. The tiles are numbered from left to right and from top to bottom.

If there is a tile that does not contain any data, i.e. all the values are set to NO_DATA field, this tile is skipped and it is not written to the hard drive.

So, where to get the tool? for Mac click here, for linux click here, and for windows click here. As usual, I have not tested the windows version, but the linux and mac versions are tested. There is a cygwin version that can be downloaded here and it is tested.

NOTE: NO_DATA value must be an integer value.

Advertisements
This entry was posted in Program, Tech Tips. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s