0

I'm working with a computer that uses multiple ASCII raster files and ran into an issue with the file alignments. As you can see in ArcMap, the rasters are being aligned correctly.

Screen shot from ArcMap showing overlaid raster data

However, upon exporting them to ASCII and loading them into the software they are slightly askew and this can be verified when looking at the headers,

$ head -n 6 x.asc
ncols         7752
nrows         4384
xllcorner     -90.415008381648
yllcorner     45.952043272731
cellsize      0.000348592492
NODATA_value  -9999
$ head -n 6 y.asc
ncols         8581
nrows         5190
xllcorner     -90.519812091
yllcorner     45.799266992357
cellsize      0.000348592492
NODATA_value  -9999
$ head -n 6 z.asc
ncols         8581
nrows         5190
xllcorner     -90.519812091
yllcorner     45.799266992357
cellsize      0.000348592492
NODATA_value  -9999

I've checked all of the typical problems (e.g., projections, clipping, etc.) and everything is being projected to NAD 1983 for the program. The library we are using for processing is fairly basic so the alignment needs to come from ArcGIS which it should be up to. There is also data present to the boundaries for the region so the theory was that should have been enough.

Perhaps there is a command I'm forgetting about, but how can I ensure that the raster files are all aligned correctly upon export?

bumped to the homepage by Community 2 days ago

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

  • First set environment extent to union of inputs. Compute cell statistics on all of them. Set environment extent, cell size and snap raster to output. Perform simple raster calculator on each. They will be identical in terms of extent and cell size. – FelixIP Apr 18 at 5:02
0

This appears to be a fairly common problems, although it might appear differently depending upon who is asking (see one, two, and three). The following is one way of ensuring that the raster files have the same extents, but for large batches scripting is most likely the way to go.

  1. Setup a polygon file that determines the bounds that you wish to work in.
  2. Make sure the polygon file also has a projection that makes sense for your data.
  3. Project the raster file to match that of the polygon file, if necessary.
  4. Clip the raster file to match the extents of the polygon, make sure "Maintain Clipping Extent" is checked!
  5. Project the clipped raster file to match the polygon file, make sure the "Output Cell Size" matches your needs.
  6. Export to ASCII raster formats as needed.

When you are done you should have a collection of raster files that have the same extents and pixel sizes. While projecting twice might be redundant, it seems to be the best way to ensure that the extents and the pixel size ends up being the same. Otherwise, you can end up with some oddly shaped pixels.

  • It won't work unless you set environment extent, snap and cell size. – FelixIP Apr 18 at 5:04
  • @FelixIP It might have been a brute force way of doing things, but the data loaded fine with GeoMASON. – rjzii Apr 18 at 5:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.