Hot answers tagged

26 votes
Accepted

Interrupting contour lines beneath elevation labels (instead of using label buffers) using QGIS?

Yes, doable. Normally I'd suggest a partially transparent buffer, but I see why you want to do this cartographically. This could be slow, and you need to manually decide where you want the labels to ...
Steven Kay's user avatar
  • 20.2k
17 votes

Producing smooth and consistent contour lines from SRTM

To smooth your contours it is the best way to smooth your DEM first. Here are some useful information: What raster smoothing/generalization tools are available? I'm using SAGA GIS for this task. ...
Stefan's user avatar
  • 4,364
15 votes

Convert raster to smooth contour polygons in QGIS

I've experienced the same problems you area having in your second method. I exported a Raster to a Vector and try to and use v.generalise and I get mostly smooth polygons with the occasional 'stepped' ...
Andrew Jeffrey's user avatar
14 votes
Accepted

Avoiding too curly contours in QGIS

Extract by expression lines over a certain length, I use 100 m: $length>100 to remove the small rings Simplify and smooth output with geometry by expression: smooth(simplify( $geometry, 4), 20). ...
BERA's user avatar
  • 67.1k
13 votes

How to perform a slope analysis in QGIS?

Slope analysis is performed on a DEM (raster layer with elevation values). This is one way to do it. If your contours have an elevation value, you can use the interpolation option (raster/...
Gerardo Jimenez's user avatar
12 votes
Accepted

Changing blending of contour label to multiply

You can change the blend mode of the text buffer in label settings (see below). Multiply works best if the buffer colour is a dark colour. However, that won't achieve what you have in your ...
she_weeds's user avatar
  • 10.1k
11 votes

How to replace pixel values in a single band DEM?

You can do something similar using gdal_calc.py, e.g.: gdal_calc.py -A dtm.tif --calc='((A>=100)*(A<=200))*A+((A<100)*0)+((A>200)*0)' --outfile=dtm_reclass.tif --NoDataValue=-32767 This ...
dmci's user avatar
  • 4,872
11 votes
Accepted

Styling contours at specific numbers

Try to do the following formula at Rule-based Style "FieldName" % 1 = 0 (Assign thick lines for 1 meter interval lines) ELSE (Assign thin lines or any other style for other ...
ahmadhanb's user avatar
  • 40.3k
9 votes
Accepted

Transform tif file to shapefile to get outer contour of area

Use the raster calculator to create an output raster with 1 where the raster equals itself. Input (nodata shown in light blue): Calculator: Output (nodata shown in light blue): Then polygonize the ...
user2856's user avatar
  • 64k
9 votes

Styling contours by colour and by line thickness in QGIS

Step 1 - Configuring the symbology type (only necessary if your contours are polygons) Change the symbology of the fill from "Simple Fill" to "Outline: Simple Line" Step 2 - Stroke ...
TeddyTedTed's user avatar
  • 5,915
8 votes

Creating DEM from contours in QGIS?

I just posted this answer on another thread that was asking the same question. This is by far the easiest method that I have found. I had the same question and looked everywhere! Finally a solution - ...
Marina's user avatar
  • 126
8 votes

Interrupting contour lines beneath elevation labels (instead of using label buffers) using QGIS?

During my research to achieve a mostly dynamic labeling of contour lines in QGIS 3.10, I put everything together in a small cooking recipe and changed my original answer to share the findings with the ...
christoph's user avatar
  • 5,036
8 votes
Accepted

Generate multiple contour lines at specific elevations

You can specify levels using the GRASS module, r.contour.level. It's available in the processing toolbox. You can search for it when the dropdown at the bottom of the Processing Toolbox window is ...
user55937's user avatar
  • 1,221
8 votes

Convert raster to smooth contour polygons in QGIS

A more direct way is to use gdal_countour directly (as a command-line program) in "polygonal mode" (that is, with the -p option). Example: gdal_contour -p -amin min_val -amax max_val -i 1 ...
Paulo Vieira's user avatar
8 votes
Accepted

Making elevation contours of raster smoother using QGIS

In my case, I have a DEM with continue values, going from 100 to 103 meters. The spatial resolution is 0.25 x 0.25 degrees, defined in EPSG:4326. The DEM is styled with a discrete color ramp with ...
Gabriel De Luca's user avatar
8 votes

Styling contours by colour and by line thickness in QGIS

Thanks to the insightful answers and comments I realized that, after applying color by graduated symbols or a color ramp, I could follow the logic suggested by both @Kadir Şahbaz and @TeddyTedTed in ...
Leigh Bettenay's user avatar
7 votes
Accepted

Exporting contour lines from CAD to GIS

If it is 3D DXF, follow the steps: import the dxf in QGIS (DRAG & DROP or CTRL + V); save as vectors (as the right mouse button); add new field Z (integer); Browser Panel to create a new database ...
pigreco's user avatar
  • 4,315
7 votes

Exporting contour lines from CAD to GIS

@pigreco's answer should work. But here a simpler solution without the spatialite process (step 1 to 2 are the same). Load your .dxf and export (save as...) as shapefile (or spatialite / postgis). ...
Pierma's user avatar
  • 901
7 votes
Accepted

QGIS - Create single contour line at specific height from DEM

Just a couple of examples are: QGIS main menu Raster | Extraction | Contour Processing Toolobox SAGA | Vector <-> raster | Contour lines (or SAGA | Vector to raster | Contour lines) (1) QGIS ...
Kazuhito's user avatar
  • 30.4k
7 votes

Showing contour line elevation labels in QGIS?

Right click the layer and open the attribute table - the elevations should be in here under one of the columns. Identify the name of the relevant elevations column, and select this from the drop down ...
Maggie's user avatar
  • 383
7 votes

Plotting a heat map onto background in python using kde?

gplt.kdeplot do not uses the value column for each point, but you can select the column row values of the GeoDataFrame for that as in KDEPlot of two NYC traffic accident contributing factors (...
gene's user avatar
  • 54.2k
6 votes

Choosing only one contour line to label in QGIS?

Another convenient expression is "ELEV" LIKE '%00' (step 100m) or "ELEV" LIKE '%00' OR "ELEV" LIKE '%50' (step 50m) or "ELEV" LIKE '%0' (step 10m) etc, where "ELEV" is my data elevation field. The ...
Antonis's user avatar
  • 61
6 votes

Interrupting contour lines beneath elevation labels (instead of using label buffers) using QGIS?

I think the closest it can get with current QGIS abilities is to use halo (or background) effect with color sourced from table which will be based on the elevation value and color scheme same as used ...
Miro's user avatar
  • 9,566
6 votes

QGIS Heatmap by value (NOT by point-densty)

What you actually want to perform is an interpolation. Heat maps are used to estimate point density between observed points. When you check "Use weights from field", you are expressing that each point ...
Lee Hachadoorian's user avatar
6 votes

How to calculate mean elevation in a DEM between a specific interval?

Set environment setting extent=your DEM extent, snap raster = DEM, cell size= one for DEM. Use raster calculator expression: Con("DEM">1500,"DEM) Right click on resulting raster, Source, scroll down ...
FelixIP's user avatar
  • 22.6k
6 votes
Accepted

How to replace pixel values in a single band DEM?

I'm not sure if you can do this with any of the gdal cli tools, but I wrote something in python which accomplishes it: from osgeo import gdal from osgeo.gdalconst import GDT_Float32 import sys ...
jeremyeastwood's user avatar
6 votes

Computing pole of inaccessibility

You could use negative buffer values on your polygons. However, in your case, I would suggest the you compute the distance from your coastlines (Raster > Analysis > Proximity (Raster Distance)) in ...
radouxju's user avatar
  • 49.3k
6 votes

Adding contour line to heatmap in QGIS?

It is possible to simply add contours to a raster image via the Processing Toolbox -> Contour (Under GDAL Extraction). Here is an example: Input Raster Image created from point layer using QGIS ...
15Step's user avatar
  • 2,352
6 votes

Labelling contour lines in QGIS?

I feel the error comes from your contour generation. If you didn't set an elevation attribute name, the attribute gets skipped and you have no way to define what elevation your contours are at. Make ...
Gabriel's user avatar
  • 3,078
6 votes

Making elevation contours of raster smoother using QGIS

There are several tools that exist in qgis to smooth contour lines as opposed to smoothing the raster itself , including vector->geometry->simplify, the vector geometry tool "smooth", and the GRASS ...
Kartograaf's user avatar
  • 2,844

Only top scored, non community-wiki answers of a minimum length are eligible