====== Contours ====== ===== Basic Processing===== There are various contour extraction algorithms in QGIS, for example: * GDAL : Raster Extraction : Contour (same as Raster -> Extraction -> Contour...) Below is an example of contours created without and with [[qgis_depressionless_dem|sink removal]]. The contours on the right have been derived from a DEM where the sinks (in yellow on the left) have been filled. {{:2019_02_08_12_17_09_untitled_project_qgis.png?300|}} {{:2019_02_08_12_17_57_untitled_project_qgis.png?300|}} It is worth noting that a [[qgis_depressionless_dem|depressionless DEM]] does not guarantee that there will be no contour sinks. A deep diagonal channel combined with a small contour interval can still cause sinks. {{::qgis_raw_contours.png?nolink&600|}} See [[https://gis.stackexchange.com/questions/390221/fix-unwanted-sink-contours-from-hydrologically-correct-dem/|GIS Stack Exchange]] for options of how to deal with this. ===== Simplifying ===== Vectors can be compressed by using something like: * Vector geometry : Simplify A tolerance of 1(m) seems reasonable for 1:25000 mapping. Smaller tolerances may be appropriate for larger scale maps (eg 1:10000, 1:5000). For more options in compression, look at: * GRASS : [[https://grasswiki.osgeo.org/wiki/V.generalize_tutorial|v.generalize]] V.generalize can also be used to smooth contours - possibly best done prior to simplificiation ===== Cleaning ===== Once simplified, it is worth removing small closed loops, such as those in the image below. {{:contour_loops.png|}} Here is one approach, which involves adding a length attribute to each contour, and removing those that fall below a certain length. It may cause issues if you have short sections of contour near the edge of the map that you need. However, that shouldn't be a problem in most scenarios. * Open Attribute Table (F6) * Open field calculator (Ctrl+I) * Add new attribute length, calculated as $length {{::qgis_add_field.png|}} * Select all features and filter on length < 25 (or whatever length is appropriate for your scale) {{:qgis_filter_field.png|}} ===== Contour Labelling ===== See separate page on [[[qgis_contour_labelling|QGIS Contour Labelling]]