2

I have been trying to generate an elevation model from contour lines using first v.to.rast.attr and then r.surf.contour. Generally, it works pretty well, execpt for one issue. My data contains a lot of sea without contours, and r.surf.contour spends a lot of time in the sea region where there are no pixels in the raster generated from r.to.rast.attr. Actually, I'm running one now on a reasobly large area, and after 24 hours, it is at 70%.

The solution for me would be simple. I have sea polygons (and even lake polygons with elevation). I could generate a separatr raster for that using v.to.rast.attr.

But then I need to combine the two rasters into a single raster before running r.surf.contour.

How do I do that?

2

If you do not need the bathymetry, then don't combine the sea raster with the land elevation raster. Instead use it as a mask as follows:

Make your sea polygon into a raster:

v.to.rast sea output=sea use=value val=1

Then make a land area raster ("inverse" of the sea):

r.mapcalc "land_area = if(sea==1, null(), 1)"

Now set the land_area as a mask, and do your r.surf.contour:

r.mask land_area
r.surf.contour...

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.