Hot answers tagged

42 votes

Fixing polygon self-intersection in QGIS?

When I get errors like this I usually find applying a zero distance buffer can fix the geometries. So use the buffer tool in QGIS and set the buffer distance to 0 units. Then try and use this buffered ...
Liam G's user avatar
  • 2,156
33 votes
Accepted

Creating temporary layer out of selection in QGIS

I think there are at least two methods: Select your features and run the "Extract selected features" tool from the Processing Toolbox (Ctrl+Alt+T). As described in this answer to a related ...
Joseph's user avatar
  • 75.6k
32 votes
Accepted

How to change the type of a column of an attribute table in QGIS?

Use Refactor Field in the Processing Toolbox. Go to Processing > Toolbox > QGIS geoalgorithms > Vector table tools > Refactor fields This will open the Refactor fields window where you can select ...
Martin Hügi's user avatar
  • 3,612
24 votes
Accepted

Styling border to match fill in QGIS?

I'm not sure how to enforce it for existing polygons, but you could make it work for any future ones that you create. In Project Properties>Default styles>Style Manager, you could create your own ...
JohnR's user avatar
  • 556
22 votes

Is it possible to rotate the canvas in QGIS

In QGIS at bottom right corner, there is an option called 'Rotation'. There you can rotate your canvas (or extent of view) by any angle.
Piyush.J's user avatar
  • 221
22 votes
Accepted

Displaying azimuth of line in QGIS

To display the azimuth, use the following expression degrees(azimuth(start_point($geometry), end_point($geometry))) To make it more fancy use CONCAT(format_number(degrees(azimuth(start_point($...
Matthias Kuhn's user avatar
21 votes
Accepted

Representing uneven tree canopy spread around point in QGIS

I have exactly the same use case at work, so this is what I have come up with: Solution 1 (ellipse) This looks fairly regular, but is the least precise generally, IMO. Use the ellipse marker symbology ...
she_weeds's user avatar
  • 12.1k
20 votes

Counting points in polygons using QGIS

The tool you're looking for is now called "Count points in polygons", and it can be found in the QGIS's Processing Toolbox (Ctrl+Alt+T) under Vector analysis tools or can be also launched ...
HDunn's user avatar
  • 8,616
18 votes
Accepted

What happened to QGIS 2.x LTR?

It's not temporary. I know that people hate change, but that's the way it is. QGIS 3.4.5 replaced 2.18 as a LTR. You can find older versions here: http://download.osgeo.org/qgis/
Dreamscape's user avatar
16 votes

How to format labels with leading zeroes?

Working on QGIS 2.18.20 I see a different behavior of the one described by @NathanW: lpad("id",2,'0')-> '02' rpad("id",2,'0')-> '20' Where I think r stands for right and l ...
Marco's user avatar
  • 3,230
15 votes
Accepted

How to generate multiple maps where one highlighted attribute changes?

What you want is creating the Atlas. In print composer, go to Atas generation tab and check Generate atlas. As covarage layer set your counties layer, and as output set your name of counties ...
Oto Kaláb's user avatar
  • 6,885
12 votes
Accepted

How to work on downloaded copies of database tables in QGIS

QGIS comes with "offline editing" functionality in core. This downloads the data to a local spatialite database, so you can work on an offline copy and the delay caused by network roundtrips is gone. ...
Matthias Kuhn's user avatar
12 votes
Accepted

Easy way to create buffer in QGIS 2?

In the 2.18.11 QGIS version there is a easy way to calculate buffers. This option is in build in the MMQGIS plugin . Once you have the QGIS plugin you have the option to create buffer When you ...
Nitzan Matan's user avatar
  • 2,847
11 votes
Accepted

Set the layers style programmatically using QGIS

for layer in iface.mapCanvas().layers(): layer.loadNamedStyle('path/to/qml/file') Or if this won't work, try: for layer in QgsMapLayerRegistry.instance().mapLayers().values(): layer....
dmh126's user avatar
  • 6,712
11 votes
Accepted

Attribute table appearance in QGIS?

You can use Open attribute table in a dock window from Setting -> Options It will be displayed like this: Update for QGIS 3.X In QGIS 3.4.5 it is possible to dock/undock the attribute table ...
ahmadhanb's user avatar
  • 40.7k
11 votes
Accepted

Looking for QGIS equivalent of ArcMap's "Selection by Location" tool with "Have their centroid in" option

There is no direct equivalent in Qgis core, but you can use the "Select Within" plugin, which should do exactly what you need (it adds an entry in the vector menu): Otherwise, you would need to ...
Leyan's user avatar
  • 831
10 votes

Setting default value in QGIS field

You can define a function which adds the project filename as an attribute and connect this function with the event that adds features. You can use the following code, change the name of the field to ...
Joseph's user avatar
  • 75.6k
10 votes
Accepted

Setting default value in QGIS field

Since QGIS 2.18, go to the layer properties / field properties and set an expression (@project_filename in this case) as the default value. https://www.qgis.org/en/site/forusers/visualchangelog218/...
Matthias Kuhn's user avatar
10 votes
Accepted

Getting points-touching-a-line attributes back to lines layer using QGIS?

Although @radouxju answer is valid, I will explain it a little more detailed. You need to make sure that the polyline feature is split exactly above the point locations. Use Join attribute by ...
ahmadhanb's user avatar
  • 40.7k
9 votes
Accepted

QGIS's Select Features tools only work occasionally

Unlike some other GIS programs, QGIS is heavily reliant on the layers panel to control inputs. So to select from a layer you first need to highlight it in the layers panel. This makes the layer ...
HeikkiVesanto's user avatar
9 votes
Accepted

What is the "command line" in QGIS on Mac?

The command line lives in two places. It depends on how you decide you'd like to start scripting and automating tasks that are often tedious or time consuming when done manually. First place is in ...
SaultDon's user avatar
  • 10.4k
9 votes
Accepted

Choosing CRS for Denmark?

Depends on what you want to portray. You will get a look similar to your second image if you use ESPG:3857 (Pseudo Mercator = looks like online maps) or UTM Zone 32N (ESPG:7416). It will look more "...
Ruslan's user avatar
  • 695
9 votes
Accepted

Add PostGIS layer to QGIS via Python Console

Here are code snippets to add a layer. I put table name in a variable since it's used twice and the geometry column because that's what I most often change. QGIS 3.x tablename = "thetable" ...
ak112358's user avatar
  • 812
8 votes

Completely uninstalling and removing QGIS 2.8.1 on Windows Vista

There are comprehensive uninstall programs available which do thorough searches and removal for all leftover files and registry values which should solve the problem. An example is Revo Uninstaller.
Jonathan West's user avatar
8 votes

Shapefile layer no longer editable (toggle edit option greyed out) in QGIS

It happened the same to me. Sometimes QGIS (2.18.11) blocks the edition when you "save as..." your project. Just remove the shp from the box and import it again. That should work. If not, save your ...
César Arquero Cabral's user avatar
8 votes
Accepted

Installing older versions of QGIS on Mac

The .tar.bz2 files are basically the source code for QGIS. You only really need to download these if you want to build QGIS yourself. If you want to download an older version of QGIS for Mac, try the ...
Joseph's user avatar
  • 75.6k
8 votes
Accepted

Fixing polygon with ring self-intersection in QGIS

I've found the solution here but for PostGIS: https://gis.stackexchange.com/a/15301/93097 and I've tested it in Spatialite/Virtual layers, and it works. Bellow the code I used with a shapefile '...
J. Monticolo's user avatar
  • 15.7k
8 votes
Accepted

How to make all the labels appear neatly in QGIS print composer?

You can use the plugin Layer to labelled layer to arrange your labels The way that it works is that it adds many new attribute columns to your shapefile to do with label size, format and placement ...
Martin Hügi's user avatar
  • 3,612
8 votes
Accepted

How to get all attributes from overlapping polygons with identical geometry into one single polygon in QGIS

If you are using QGIS2.18, concatenate() function in Aggregate group may be helpful. Suppose I have a polygon layer of 5 duplicated stars (id: 1-5) and one rectangle (id:10) and each stores value I ...
Kazuhito's user avatar
  • 30.7k
7 votes

Enabling SAGA in QGIS?

On my installation of QGIS 3.10.4 on Ubuntu 20.04 I had to install SAGA manually via sudo apt install saga After restarting QGIS, SAGA was then listed in the processing toolbox.
Florian Brucker's user avatar

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