I have many raster files each one containing information that is different from the others (e.g. one contains information on rain, the other on altitude, and another on land use). The cells in each raster file may or may not line up with the cells of the other raster files.

My goal is the following: I need to create a text file where each row represents a cell and, along the columns for that row, contains the information in that cell on rain, altitude, land use, etc.

What workflow would you suggests to "merge" these raster files together so that their cells line up and contain all the information available across all of the rasters?

I am using ArcGIS 10.1

  • Actually it depends on what software you are using (for example, i can suggest using ArcGIS software and do layers overlay with your preferred options and get whatever statistics you need) – Shehab Oct 17 '14 at 16:15
  • 1
    Are you compiling data for a regression-based analysis? – Aaron Oct 17 '14 at 17:02
  • Unless these rasters are tiny, outputting a text file will be very inefficient. I just want to encourage you to consider whether that format really is necessary. (It probably isn't if you will continue your analysis in ArcGIS; it might or might not be needed in order to transmit the data to non-GIS software.) – whuber Oct 17 '14 at 17:41
  • Aaron: Yes the data will be used to estimate a statistical model (though I don't think its OLS) whuber: The analysis cannot be done in ArcGIS since it requires the estimation of a complicated statistical model which has been coded in matlab. If you can suggests a more efficient way to extract the pixel level information, that would be great. – PollPenn Oct 17 '14 at 23:42

In ArcGIS, use the Resample tool to resample two of the three rasters into a cell size that matches the third on.

You'll need to consider what you're doing to your data when you resample.

With that in mind I would pick the Land Use raster as the one that goes unmodified since the others are likely already interpolations of discrete samples of continuous data.

Also, for the set up when using the Resample tool, go to the Environments settings and pick one of your three rasters (Land Use e.g.) as the Snap Raster under the Processing Extent section. Snapping to that will insure the cells line up.

Lastly, I'm assuming these rasters are already in the same projection.

  • Hi there, thanks for this. This is very helpful and I will try to implement it and get back to you if it works. – PollPenn Oct 17 '14 at 23:46
  1. If you are more focused on getting the text file than the precise alignment of the rasters, you could convert one raster to points to create a grid of points (Conversion Tools). Choose the raster with the alignment that most closely matches the desired position and spacing of the cells. The grid values of that raster will already be present in the point attribute table.
  2. Then use Extract Multivalues to Points (Spatial Analyst) to "extract" the values of all the remaining rasters underlying each point in the grid. Choose meaningful field names. You only get 10 characters. The nice thing about this tool is that if you add more rasters later, you can Extract to the existing points and not have to create a new point layer every time.
  3. If you need point coordinates, use the "Calculate Geometry" option to add that to the attribute table (optional).
  4. Export the attribute table for the points layer to a text file.

This will not fix the cell alignment of the different rasters, so you may need to inspect the points along the edge of the grid to see if all points are covered by all rasters. Depending on your needs, you can remove those points up front or deal with missing values later on. Also note that if there are mismatches in coverage or NoData values in the middle (holes), the attribute table will show the NoData value (often 99999 or something very long, large number) for that point. You will have to use search and replace to deal with these in the text file later. The NoData value for each raster can be found in Properties.

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.