0

I have created a raster layer of heights using the TIN interpolate function. I also have another raster layer with more accurate information on the height of particular areas defined by polygons/lines. I would like to remove these sections from the TIN generated raster and replace them with the information in the second raster.

I have tried using the clipper function, but this removes the wrong part (it retains the sections I want removed). Can anyone provide some guidance on how to achieve inserting values from a section of one raster into another?

QGIS 2.6.0 on Windows.

2 Answers 2

1

You may want to investigate the RasterCalc plugin and its conditional function. The default Raster Calculator doesn't have this ability. The plugin has documentation on syntax.

Without knowing the details of your raster I can't say for sure, but assuming the 'accurate' raster only has data in the desired cells and everything else is 0, you'll make a con statement to the effect of 'if accurate = 0 then TIN, else accurate'.

If you only have vector data that marks the boundaries of the good data in the accurate raster, you'll need to get that converted to raster (Raster > Conversion > Rasterize) to create a mask/zone raster. Note it should be polygons, not lines, which won't convert the same. Then your con statement would be more like 'if zone = 1 then accurate, else TIN'.

2
  • Thanks for the answer, this is what I wanted, unfortunately this pulgin does not appear to be compatible - I tried installing it but when I went to run QGis tells me it is only compatible up to 1.99.
    – B Glover
    Nov 27, 2014 at 10:09
  • @BenGlover Sorry about that, good to know. I'm surprised it hasn't been updated yet, though it may be possible QGIS's native Raster Calculator has been expanded (and perhaps not documented). As you've found though, Con is sort of a built tool where the function can be replicated with additional/more basic steps or raster math formulas.
    – Chris W
    Nov 27, 2014 at 19:02
1

I have come up with a solution/ workaround (sightly specific to my problem):

Step 1: Use clipper tool to extend the rasters to the same size.

Step 2: Add the two rasters together.

Step 3: In my situation the addition of the two rasters produced a raster where the values in the areas of interest (where I wanted more accurate data- note outside of these areas the accurate raster had value 0) was larger than the max of the TIN raster. This allowed me to perform a simple operation:

('SummedRaster' >= 'Value')*'Accurate'+ ('SummedRaster' < 'Value')*TIN

To clarify, in areas with more accurate info. the summed elevations were luckly higher than the maximum value in the TIN raster.

So where the summed elevations were greater than this max value I could replace the data with the elevation from the Accurate Rater.

Any place outside these zones the combined elevation was less than or equal to this max TIN value and hence these cells could be filled with the data from the base TIN raster.

Your Answer

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

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