Hot answers tagged

24

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 go - but cartographically speaking, that's not a bad thing! Here's a screenshot... As you can see, no buffers. The raster underneath is unaffected. I've ...


15

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' boundary which appears to have been unaffected by the algorithm. I found a process that worked for my task, not sure if its the best way but thought i'd share ...


14

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. Using SAGA GIS Version 6.2.0 directly: Grid > Filter > Gaussian Filter Or use the QGIS Processing Toolbox and search for gaussian. Warning: Using QGIS 2.18....


13

In QGIS 2.6 (maybe earlier versions as well, I don't know) you can do this under the Layer Properties, Labels tab, Rendering section. About halfway down the list of rendering options is a button that will let you write an expression which will define the list of features that will actually be labeled. Your expression would be something like "Elevation" IN (...


13

One approach would be to load the contour layer and style it. Then load the same layer again and apply a filter (right-click on the layer and go down to 'Filter..') Use a filter expression similar to the one shown in the picture. In my case I wanted major contours at vertical intervals of 50 metres and the field containing the elevation values was called "...


11

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/interpolation) to produce a DEM. For instance, here are my contours as a shapefile The attribute table do have a value for altitudes in the "elevacion" field. Now you can ...


11

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 screenshot (see results below): Instead, you should use the new Mask setting in QGIS 3.12 to mask out the line symbology in a buffer around the text. First, in your ...


10

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 calc expression would: Assign a value of 0 to all pixel values less than 100 ((A<100)*0) Assign a value of 0 to all pixel values greater than 200 ((A>200)...


10

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 interval lines) In the above image "Elevation" is the name of the field that holds the contour elevation.


9

Here is another query option. It largely does the same as the answers listed above but is (in my opinion) a little bit easier to customise for different scenarios. To display any contour divisible by 10 Floor(Elevation/10)=Elevation/10 To display any contour divisible by 50 Floor(Elevation/50)=Elevation/50 To display half metre contours Floor(...


9

I assume your goal is to have different stroke weights for multiples of certain values - ie, one line weight for lines that are multiples of 10M, another for multiples of 100M, and so on. The details of how to do this depend on your software, but my general approach is to open the attribute table associated with the shapefile and add a new field which will ...


9

Sirgeo, don't try to fix up contours after they are generated, the processes take a long time and will eventually lead to intersecting contours = a nightmare! Instead smooth your raster to take the lumps and bumps out - easier maths and no topology to worry about. I find resample slightly up (cellsize x 1.5) and then back down to the original (or better) ...


8

You can download raw contours lines from the National Map Viewer. I like to download by bounding box (button highlighted in red).


8

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 switched from "Simplified interface" to "Advanced interface". The "List of contour levels" parameter takes a comma separated list of elevation levels. Here is ...


8

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 three classes: To smooth it, first I will make a raster algebra. Because I want a raster with only three values. I am using the following formula: ("...


7

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 community. The solution result: And here are the ingredients: a "linestring" layer called "contours": the file format doesn't matter in that case, but I ...


7

Using the Contour plugin. Generate isolines and/or filled contours a set of data points.


7

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 input_raster.tif output_shape.shp Documentation: https://gdal.org/programs/gdal_contour.html This option is available only in version >= 2.4 (this can be checked with ...


7

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 spatialite; DBManager to import the shape in the newly created database; run the update query; step 1 step 2 step 3 - add new field Z step 5 -DB Manager ...


7

@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). On the new layer, use the Field Calculator (accessible from the main toolbar or from the attribute table). Setup the new column (name and type, virtual or not ...


7

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 Contour After setting your input file and output filename, turn the bottom window into "edit mode" by clicking on the pencil mark. Then add -fl 4.54 in the ...


7

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 menu when choosing 'label with'. If the elevations aren't included in the attributes, then the data you require is missing. Feel free to send screenshots of ...


6

I used this tutorial to create a Digital Terrain Model (DTM). It uses as input contour shapefiles converted in raster contours that are later interpolated in DTM (looks like a continuous heat map) It is not using QGIS but just GRASS, but it may be feasible with the Grass plugin from QGIS.


6

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 for underlying grid. Of course this would not take into account hillshade and everything else below the halo in the map. Random color example: With some bit ...


6

Assuming that the "USGS-provided lidar tiles" are DEM rasters (where they already isolated the ground points, incorporated breaklines & hydro flattened), the most "accurate" contours would be derived by not doing any smoothing and just generating contours directly from the original USGS rasters. These contours are going to not look good for cartographic ...


6

When you generate the contours in QGIS, make sure that you tick the Attribute name box. Then when you ogr2ogr (you must use command line - this is not an option in QGIS Save AS), specify the zfield. For example, if your elevation attribute is "ELEV", then your command could look something this: ogr2ogr -f "DXF" contours-out.dxf contours.shp -zfield ELEV ...


6

I'm using this approach wich makes the labeling and display of contourlines by condition quite easy. I use the "Data defined properties" of the line symbol width and colors of the contourlines with an expression (see screenshot 1) by which you can apply different line widths based on custom conditions and a similar expression for labeling (see screenshot 2)...


6

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 has a count other than 1, but the method is still estimating a point density. Interpolation, on the other hand, estimates values at unknown points between ...


6

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 to see Mean


6

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 order to get a continuous distance raster. Then you can compute the local maxima with some SAGA GIS tools or you can derive your contour lines (raster > ...


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