Hot answers tagged

39 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,096
35 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!
  • 73.3k
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,492
26 votes
Accepted

Creating a temporay layer out of a selection in QGIS

I think there's atleast two methods: Select your features and run the Save selected features tool from the Processing Toolbox. As described in this answer to a related question: Select your ...
  • 73.3k
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.
  • 82.8k
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

Fixing geometry validity errors in QGIS 2

When I have a layer with errors , I normally run it through the GRASS function v.clean in the Processing Toolbox. Though I never really figured out which tool is best in which case, I normally choose ...
  • 3,117
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 ...
  • 73.3k
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 ...
  • 7,934
18 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.
  • 181
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/
16 votes
Accepted

Can PostGIS and QGIS provide dependable multi-user editing?

Since you're not worried about simultaneous edits on features, I'd say that in theory you have nothing to worry about. The main danger w/ QGIS is that simultaneous editors can stomp on each other's ...
  • 19.5k
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,577
14 votes

Georeferencing window won't open QGIS 2.4

I had the same problem. This should solve the bug (QGIS 2.6 under Windows): close QGIS using regedit.exe, search for "Plugin-GeoReferencer". This should point to a folder under \HKEY_CURRENT_USER\...
  • 271
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,369
12 votes

Creating DEM from Point Data using QGIS?

A DEM (digital elevation model) is a raster and not contour lines or polylines. If the point data is a systematic grid of points (equal spacing) then it is as simple as converting straight to raster ...
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.3k
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,777
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,331
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 ...
  • 73.3k
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 ...
  • 38k
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,492
10 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 ...
  • 38k
10 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 ...
  • 811

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