0

I have a raster GeoTIFF file downloaded from GEBCO 2014 which contains bathymetry and elevation.

I need to split in 2 layers the raster GeoTIFF file (layer: Bathymetry and layer: Elevation) using coastline vector layer.

Can QGIS 3.4.4 do this?

  • Hi Iven, yes, QGIS can do it. But we don't understand what you have and what you need. Raster has just 1 band for both values? You want a raster cointainig only negative values and another raster containing the positive values of the orginal raster? – Gabriel De Luca Jan 26 at 18:45
  • Well, raster has 1 band and i want to split the raster at level 0 bathymetry and elevation. – Iven Pepa Jan 26 at 18:48
  • Yo can do it with raster calculator, with something like: If the value of the pixel is negative, reproduce that value; if positive, turn it to zero (or to another value assigned to nodata). Would be that a solution for you? – Gabriel De Luca Jan 26 at 18:53
  • Yes, but can you explain step by step how to complete because i dont know much in qgis? Thank you – Iven Pepa Jan 26 at 19:00
  • Sure, I already added an answer with the detailed procedure. – Gabriel De Luca Jan 26 at 19:53
1

Yes, QGIS can do it.

I can show you step by step in QGIS 3.4.4, which is the version I am using.

You may have some problems when trying to replicate the procedure in QGIS 3.4.3. We'll talk about it later.


What you can do is create a raster that contains the negative values of the original raster (and zero in the positive ones) to keep the bathymetry. And use the same procedure to create a raster that contains the positive values of the original raster (and zero in the negative ones) to keep the elevations.

Here I have a test project with a raster of elevations, of which I want to remain only with the values less than 1000.

raster calculator-1

For this purpose we will use the raster calculator tool.

We will establish a conditional expression, which evaluates if the value of the pixel is less than or equal to 1000: ( "S44E171@1" <= 1000 ).

The condition returns 1 if it is true, 0 if it is false. Therefore, we multiply the result of the evaluation by the original value of the pixel: ( "S44E171@1" <= 1000 ) * "S44E171@1".

As a result, a new raster will be created that contains the original values if they are less than or equal to 1000, and zero in the others.

Remember to give a reference layer for the extension and resolution of the output (the layer containing the original raster is a good choice).

raster-calcultor-2

Then, we will make some changes in the way we represent the created raster, establishing manual values for the gray scale,

raster-calculator-3

and adding zero as a nodata value.

raster-calculator-4

I show how the result looks. We could do the same thing again to get only values greater than 1000 in a new output.

raster-calculator-5


In QGIS 3.4.3, we had to deal with two issues to using the raster calculator. On the one hand, it did not accept values that were not of the Float32 type. On the other, when wanting to translate the type of value, the GDAL tool failed and a module had to be reinstalled manually. Both drawbacks are detailed in this answer(Reclassify and combine rasters in QGIS?).

Fortunately, both problems (and many more) were fixed in version 3.4.4. So I highly recommend keeping your version of QGIS up to date.

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.