Matthias Kuhn
  • Member for 9 years, 5 months
  • Last seen this week
Adding Basemaps from Google or Bing in QGIS
201 votes

No plugin required There is a core functionality XYZ Tile Server provider which was implemented with some other nice UX enhancements for tiled services (available since QGIS 2.18). This means, that ...

View answer
Ignoring invalid input features with Intersection tool in QGIS?
Accepted answer
62 votes

Go to Settings > Options > Processing and under General change to Ignore features with invalid geometries. Alternatively, it's also worth checking the answer by A.Oikonomidis as well as other tools ...

View answer
Where does QGIS write its error log messages?
42 votes

QGIS does not write its log messages to a file by default. If you have a debug build (nightlies normally are) they are written to stdout. That means that if you run it in a terminal on linux you will ...

View answer
Was QgsMapLayerRegistry being removed in QGIS 3?
Accepted answer
42 votes

Yes it has been removed, but alternatives exist. Changes of the 3.0 API are listed here: https://qgis.org/api/api_break.html QgsMapLayerRegistry: Its functionality has been moved to QgsProject. ...

View answer
Creating Conditional Statement in QGIS Field Calculator
Accepted answer
41 votes

The easy way The most simple way to do this is to create a new field with the expression "cat" > 20 This expression will evaluate to a boolean True/False which will be represented as an integer ...

View answer
Is it possible to show our custom message in QGIS Status bar using python?
Accepted answer
38 votes

StatusBar There is iface.mainWindow().statusBar() which returns a QStatusBar iface.mainWindow().statusBar().showMessage( u"Hello World" ) MessageBar Starting from QGIS 2.0 there is also ...

View answer
Creating point features with exact coordinates in QGIS
36 votes

No Plugin Required This is possible with QGIS without extra plugins using the Advanced Digitizing panel. This tool allows entering exact coordinate values as well as constructing points at given ...

View answer
Combining Columns QGIS Attribute Table
Accepted answer
32 votes

Many operators and functions in SQL (and therefore expressions) return NULL if one of the parameters was NULL The following examples demonstrate the behavior of various operators on a layer with the ...

View answer
Can QGIS 3.0 be installed and run side-by-side with QGIS 2.x?
Accepted answer
27 votes

Short answer Yes Slightly longer answer The two applications save all their settings in different places and when they use different versions of the same library, these library versions can safely ...

View answer
Adding text fields with more than 255 characters?
Accepted answer
25 votes

Shapefiles have a limitation of maximum 254 characters per field (See switchfromshapefile.org). If you need more than that you will need to switch to a different format. If you don't know which file ...

View answer
Protecting QGIS Plugin source code
Accepted answer
24 votes

QGIS is licensed under the GPLv2, this same license applies to QGIS plugins. QGIS has written a blog post that clarifies on the licensing as well as on the commercial aspects of this. With respect to ...

View answer
Missing Processing Tools in Vector Menu of QGIS
23 votes

The fTools plugin offered these menus and it has been removed from QGIS and is replaced with the processing plugin. Just enable the processing plugin and the menu will be back. Note that you can go ...

View answer
How to set a default value for attributes in shapefiles in QGIS?
Accepted answer
22 votes

QGIS 3 Select the layer in the layer panel and left-click. Select properties. Select the "Attributes Form" as shown below. Select the fields from the "Available Widgets" list as show. Provide an ...

View answer
Deleting selected features using PyQGIS?
Accepted answer
21 votes

You can loop over the iterator and get the .id() for every feature in it: with edit(layer): # build a request to filter the features based on an attribute request = QgsFeatureRequest()....

View answer
How to find unique values of an attribute with python in qgis?
20 votes

QGIS provides a simple API to get this information. You need to get the index of the field in question and then query the layer for unique values. idx = vectorLayer.fields().indexOf('fieldName') ...

View answer
Displaying azimuth of line in QGIS?
Accepted answer
19 votes

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($...

View answer
QGIS, Populate field with self-updating formula (like spreadsheet)
18 votes

Yes, this functionality is called virtual fields. Open the field calculator and check the "virtual field" checkbox. The value will then be updated (or rather it is recalculated every time it is ...

View answer
Setting transparency per polygon in shapefile in QGIS
Accepted answer
17 votes

You can use data defined properties for this. Use the style tab on the layer properties and click the expression button to the right of the color. In there you can use the function color_rgba( red, ...

View answer
Programmatically associating layer with custom UI using PyQGIS?
Accepted answer
17 votes

Form layout You have the following methods to do this: QgsVectorLayer.setEditForm( '/path/to/your/ui/file' ) to provide a UI file and QgsVectorLayer.setEditFormInit( 'python.Function' ) to provide a ...

View answer
Activating layer by its name in PyQGIS
Accepted answer
16 votes

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() ...

View answer
How to avoid creating corrupt Shapefiles during Editing?
Accepted answer
16 votes

Explanation OGR (part of GDAL) is the library used by QGIS to access shapefiles. When OGR deletes features it does not delete them immediately, but just marks the features as deleted. Once in a while,...

View answer
What are QGIS equivalent functions for ArcPy's Update/Delete Row/Field?
Accepted answer
16 votes

The following examples are based on the (soon-to-be-released) QGIS 2.0 API. This has changed since 1.8, so the syntax for this version will differ in some places. The best resource for 1.8 compliant ...

View answer
How to evaluate raster calculator expressions from the console?
Accepted answer
16 votes

Starting from QGIS 2.0 (and current development version), the class QgsRasterCalculator is available in python. Unfortunately it is not very well documented. The basic usage is, that you have to ...

View answer
Filter features based on their attributes using Python
15 votes

You can simply do: features = l.getFeatures('"Counties" = \'Norwich\'') The QGIS expression engine is also able to do this using the QgsFeatureRequest.setFilterExpression(str) method (Since ...

View answer
Rendering polygons ordered by size in QGIS
Accepted answer
14 votes

Most data providers do not guarantee any order in the way they deliver features. While an apparently stable order is often a side effect of the order in which features are stored in files, one shouldn'...

View answer
QGIS query syntax differs between attribute table and feature filter
Accepted answer
14 votes

Your observation is correct, The Query Builder does not use the same syntax as the rest of QGIS. Throughout QGIS, the syntax is based on QGIS Expressions a customized SQL dialect. This is portable ...

View answer
How to automatically reload raster layers if source is changed in QGIS?
Accepted answer
14 votes

I suppose your question does not include change detection, as your sample only concerns QgsMapCanvas.refresh() Instead you have to call QgsRasterLayer.triggerRepaint() If your layer is called ...

View answer
How to create polygons with straight lines and right angles in QGIS?
12 votes

No plugin needed In addition to the Shape Digitizing Toolbar it's also possible to add right angles through the Advanced Digitizing Tools. Activate the Advanced Digitizing Tools and lock the angles ...

View answer
How to work on downloaded copies of database tables in QGIS
Accepted answer
12 votes

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. ...

View answer
Why blank values in attribute table don't work as NULL in QGIS?
Accepted answer
11 votes

NULL is not equal to an empty string. NULL is by definition an "unknown value" of which we cannot assume anything. Whereas an empty string is a string without contents. You can test for ...

View answer
1
2 3 4 5
13