Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have two grids with same cell size, same starting position (top left) and same grid size. I want to sum the grids and create a sum grid as an result:

e.g. grid A + grid B = grid C

How can I achieve that with GDAL?

What happens, if my grids are not identical (1) in grid size (2) in starting position and (3) in cell size.

Thank you very much for the answer.

share|improve this question
add comment

1 Answer 1

I am answering my own question:

You can use gdal_calc.py Python library to achieve this.

http://svn.osgeo.org/gdal/trunk/gdal/swig/python/scripts/gdal_calc.py

Here all the files have to be the same dimension. I still do not know how to accomplish this if grid's are not in the same size.

share|improve this answer
1  
Raster 'mapematics' is essentially just maths using arrays. So, you need to make your rasters (and therefore the arrays) the same size, either by expanding the extent of one or both (depending on the overlap) or cropping to the limits of the overlap. You can do that either by manipulating the rasters or their array equivalents. You must consider carefully how you will handle NoData. The easy way to do this sort of operation is use QGIS which will handle the mismatch of the grids for you. –  MappaGnosis Mar 6 '13 at 8:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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