I'm using QGIS 2.16.1 on Windows to try to extract elevation data into curves that I can use to cut/build a wooden topo map. I'm vaguely following this guidance, but also am changing things up a bit as needed (my data is across multiple files, etc). I'm in really deep water here as I'm a woodworker and not a mapping person (yet!).

I've imported 6 raster layers of elevation data from the ArcGRID datasets, merged them into a Virtual Raster, and ran Raster > Extraction > Contour at an interval of 125. After several minutes of chug, I get the contours. Awesome!

My problem: Trying to save myself some data chunking time (I'm doing some smoothing and eliminating of too-small-for-wood contours), I wanted to eliminate the data and contours that are outside the boundary of the region I wanted to topo (several of the data files only overlap my region by a tiny amount). I loaded a shapefile for the region boundary (it's a national park so finding that was easy) and used Raster > Extraction > Clipper to clip the Virtual Raster to the shape. It appears to work and generate a new Clipped Raster (my name for it) in the right shape that visually matches the original data. Problem is, when I try to run Contour on the Clipped Raster, it generates an ERROR 1: CPLRealloc(): Out of memory allocating 416 bytes.

As first I assumed the clipping shape was too complex, so I tried with just a square and it fails with the same error. Seems any Clipping of the Virtual Raster drives the error.

Is there any way I can fix this or any other method to take the elevation data from multiple files, "combine it" and extract contours?

1 Answer 1


I know it's a long time ago since this question was asked, but since there's no answers yet, here's what solved the problem for me when I just had the same problem with QGIS 2.18.1. I simply tried clipping the original raster again, but this time I specified the nodata value to be a value not too far from the actual data, instead of going with the default -3.4e+38. That did the trick. I should also mention that before this I tried specifying the (default) nodata value when contouring the clipped raster, but this approach still generated the memory error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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