Hot answers tagged

41 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 ...
  • 2,126
36 votes
Accepted

QGIS Filtering Multiple Values using Query Builder

One method is to use the IN function followed by your list of values all inside brackets. E.g. "Column_Name" IN ('Value_1', 'Value_2', 'Value_N') Hope this helps!
  • 74.1k
30 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 ...
  • 74.1k
29 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 ...
  • 3,521
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 ...
  • 556
23 votes
Accepted

Missing processing menu in QGIS

The Processing menu is tied to the Processing plugin. So please check if you have deactivated the Processing plugin in the Plugin Manager.
  • 83.3k
20 votes

Resizing the map item in QGIS print composer without changing scale?

Update 27/07/2018: As of QGIS 3.2.1, my workaround below no longer works! If I find an alternative solution I will post here again. This is very, very annoying... There is a way to do this. In the ...
  • 201
20 votes
Accepted

Completely uninstalling and removing QGIS 2.8.1 on Windows Vista

You can make sure all folders in your hard drive and your .qgis2 folder (C:/Users/You/.qgis2) are deleted. You could also delete the Registry entries for QGIS by running the regedit program and ...
  • 74.1k
20 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 ...
  • 8,784
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 ...
  • 8,456
19 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.
  • 191
18 votes
Accepted

Activating layer by its name in PyQGIS

TL;DR To get all features of a layer by the layer name you do not need to activate it. Just use name = 'counties' layer = QgsProject.instance().mapLayersByName( name )[0] poles = layer.getFeatures() ...
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/
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 ...
  • 6,657
13 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 ...
  • 3,130
13 votes
Accepted

User Interface file compilation using OSGeo4W shell during qgis plugin creation

I will write a quick explanation of the pyuic4 and pyrcc4 commands for future reference. Most tutorials simply tell you to copy some code, but no one explains exactly what you are about to do. It is ...
  • 6,431
12 votes
Accepted

Using qgis:selectbylocation in PyQGIS

I used this code: mapcanvas = iface.mapCanvas() layers = mapcanvas.layers() processing.runalg('qgis:selectbylocation', layers[0], layers[1], u'within', 0) with this situation: and it worked: ...
  • 27.9k
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. ...
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 ...
  • 2,797
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 ...
  • 39k
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 ...
  • 821
10 votes
Accepted

Creating several maps showing different layers but same area using QGIS?

In QGIS 2.8 you have the option to lock the styles in a map. First add number of map pages in the print composer. Example with two maps: And the corresponding print composer In the Print Composer ...
  • 7,371
10 votes
Accepted

How to style a vector layer in QGIS using hexadecimal color code stored in attribute?

In Layer Properties make a click on "Simple Fill" (in the left part). On the right side click the symbol for data defined color and choose Field type: string > color (field in the attribute table). ...
  • 355
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 ...
  • 74.1k
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/...
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 ...
  • 39k
10 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....
  • 6,512
9 votes
Accepted

Difference between Feature and Geometry

Feature, according to the Esri GIS dictionary: A representation of a real-world object on a map. Geometry, according to the Esri GIS dictionary: : The measures and properties of points, lines, ...
9 votes
Accepted

Creating compressed GeoTIFF with QGIS Clipper tool?

The Clipper tool makes an uncompressed image by default. Read the GDAL manual of your format and add manually the compression options into the gdal_translate command that is shown in the lowest pane. ...
  • 58.8k
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 ...

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