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?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.Sign up to join this community
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.
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).
Then, we will make some changes in the way we represent the created raster, establishing manual values for the gray scale,
and adding zero as a nodata value.
I show how the result looks. We could do the same thing again to get only values greater than 1000 in a new output.
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.