The first long-term release (LTR) of QGIS 3. QGIS 3.4 just released. After five consolidation point releases (3.4.5) it will replace the previous LTR in the package repositories in February 2019 (see release schedule).
This is a giant leap forward for the project - our first Long Term Release based on the 3.x platform. For users moving over from the 2.18 LTR there is a huge list of new features and impactful changes in this new LTR version.
Please bear in mind that 3.x plugins are incompatible with 2.x plugins so review your plugin usage carefully - and if possible help to migrate old plugins to the new platform. If you have not already done so, take a look at the changelogs from Version 3.0 and Version 3.2 to understand the full scope of changes in the 3.0 release.
Often it is useful to select/identify features that are covered by an existing polygon. For this, users can use "Select Features by Polygon" and "Identify Features by Polygon" tools, but it was necessary to manually trace the polygon of interest. This new feature allows user to right click on the map and pick an existing polygon feature at that location from popup menu - that polygon will be used as input for selection or identification.
This feature was funded by Leicestershire County Council
This feature was developed by Peter Petrik (Lutra Consulting)
Whenever a message bar item links to a created file (e.g. after exporting a layout or map layer), the link will now directly open the folder containing this file within the operating system file browser AND pre-select the created file. It's a super-handy shortcut speeding up file operations after an export from QGIS!
This new option in the right-click context menu for disabled entries on the welcome page allows users to open the closest existing path to the original project location in their file manager, to hopefully help them re-locate missing/moved/renamed projects.
Temporary Scratch Layers in QGIS can be very handy when a "throw-away" layer is needed, such as when pre-processing data in multiple steps. However, they can be a trap for uniformed users who may not realise that the contents of the layer will be permanently lost when the current QGIS project is closed. Accordingly, a new indicator icon has been added which shows up next to any temporary scratch layers in the layer tree, making it immediately clear which layers are temporary only.
It's also much easier to transition these temporary layers to permanent disk-based formats. You can either click the new indicator icon or select "Make Permanent" from the layer context menu. QGIS will then prompt for a location to save the temporary layer to, then replaces it in place (keeping the same layer ID, style, form settings, etc).
The QGIS task manager widget (shown in the status bar whenever a background task is running) now shows an estimated time remaining and completion time for long-running background tasks. This ETA is calculated using a simple linear interpolation based on the task's elapsed time and current progress, and allows users to know whether they've only got time to make an instance coffee in the office kitchen or walk round the block for a proper barista made coffee before that long processing task completes...
Additionally, QGIS uses the standard operating system progress reporting mechanisms on more platforms and occasions in QGIS 3.4. Some long running tasks (which don't run in the background) such as atlas exports now show their progress via the operating system mechanism, and throw up handy completion notifications.
For local vector and raster datasets, the Information tab within the layer properties dialog now features source file path hyperlinks. Upon clicking on the hyperlink, the system's file navigator will open and automatically highlight the dataset.
The QGIS Style Manager dialog (which allows users to setup and manage their own libraries of symbols and color ramps) now opens non-modally, so it can now be used alongside the main QGIS window (just like the Layout Manager dialog and Print Layout Designer windows).
We've also improved the preview of symbols within the Layer Styling dock, adding a toggle to switch between a large icon view and a detailed list view of symbols. Hovering over symbols (and colors!) now shows a large preview of the symbol. Finally, we've made symbol lists more hi-dpi friendly.
Tons of work was done for this release to improve the user interface and experience of the browser panel including HiDPI fixes, compressed vector/raster dataset improvements, and a refreshed icon set.
Functionality has also been added, including the ability to create a new directory directly from the browser context menu. The browser also now shows a more complete range of options for SQL Server connections, matching those options which were already available for other database connections.
This feature was developed by Mathieu Pellerin (iMHere Asia), Nyall Dawson (North Road)
A new type of vector layer form widget for showing graphically appealing and interactive items like charts or technical drawings on the attribute form has been added in QGIS 3.4.
The widget sports a flexible configuration, including example templates and expression support.
When exporting and importing styles to and from .qml files it is now possible to select a subset of sections.
This allows to save and restore parts of a layer configuration while omitting others. For example, it's possible to export only the symbology of a layer and when importing this QML style file o layer, any configuration on the forms and widgets or other properties are unaffected.
It is also possible to only handle single sections of a style when using copy/paste.
This will update camera's view center as the camera moves around.
Before the view center would be always at the zero elevation, which
means that with terrain further away from zero elevation tilting
and rotation of camera would feel weird due to the center point being
Allow moving camera up/down using page up/down keys
Move camera keeping the position with Ctrl + arrow keys / mouse
You can create an animation based on a set of keyframes - camera positions at particular times. QGIS 3D then interpolates the camera positions/rotations in between the keyframes.
To create the keyframes, first set the scene for your map, by rotating, zooming or moving the camera. Then assign a time to the frame. There are several methods for interpolations between keyframes.
This mode of 3D line rendering will use OpenGL line rendering
instead of buffering lines into polygons and rendering them as meshes.
The advantage is that the 3D lines do not loose their Z coordinate
which is the case currently with "ordinary" 3D rendering after buffering.
The disadvantage is that the lines cannot be wide (supported in Qt3D only
since 5.10, but even then their rendering won't have nice joins/caps)
and only ambient color is used from the material.
A new Identify Tool was introduced to 3D map. Using this tool, you can inspect features from the 3D scene.
This feature was funded by Department of Environment, Land and Infrastructure Engineering (DIATI)
This feature was developed by Martin Dobias (Lutra Consulting) and Faunalia
Some classes from QGIS 3D have been made available for Python developers. It is now possible to query or change 3D renderers of map layers and read/write properties of contained 3D symbols such as material colors. Please note that for now the API is considered as experimental, so it may change in future 3.x releases.
Many new expression functions have been added in QGIS 3.4. These include many handy functions for working with and manipulating arrays and maps (dictionary) objects.
Additionally, some new variables have also been made available for use within QGIS expressions:
This feature was developed by Etienne Trimaille, Matteo Ghetta, Matthias Kuhn, Mathieu Pellerin, Nyall Dawson
Autocompletion for code in the expression editor.
QGIS 3.4 extends the inbuilt GPS tracking support, adding "acquisition interval" and "distance threshold" parameters. These options can be used to keep the cursor stationary when the receiver is in static conditions.
The new vertex is a lot more productive now. It can move vertices of all editable layers at once, which is great to preserve cross layers topology. However in many cases, many of us didn't want modify all layers at once. We added a variation of the vertex map tool just for that.
Vector layers have a precision configuration option.
The precision defines how precise the location of nodes should be saved. Each node of new or edited geometries is snapped to a grid of this resolution.
While digitizing, the grid is shown to guide the user.
When adding or editing geometries on a vector layer, QGIS can automatically remove duplicate nodes from geometries.
This option is configurable in the digitizing tab of vector layers.
Each new or edited geometry can be checked for validity if this option is activated. This allows to communicate transparently to a user when there are erroneous geometries produced by the current edit session.
Topology checks can be activated on a layer.
On newly added and edited geometries, topology checks can be executed. The checks will be executed, when the layer is saved or upon a click on the topology check button on the geometry validation panel.
The following checks are available:
This builds on top of the functionality of the geometry checker plugin which was implemented by Sourcepole.
Like QGIS and the plugins, the projects are translated with the Qt translation process. Means, it makes the translation according to a Qt Compiled Translation Source File (.qm file). When the user opens a project, QGIS checks for a .qm file laying in the same folder like the .qgs file, having the same name like the .qgs file and having the language-code as postfix of the users language (the language configured in the QGIS settings).
To create the translation, in the project settings is an option to generate the .ts file, that can edited by programs like Qt Linguist or Transifex.
More information in this blog post
A button has been added to the Attribute Table toolbar for switching between docked and window mode on demand. Previously users had to change an option in the settings dialog and open a new table in order to switch between docked/undocked mode, but that's painful if you decide after a table is already open that you'd like to dock/undock it...!
A new locator filter has been added which allows users to search across all layers in their project, by the layer's display expression.
The filter can be activated by using the prefix 'af', or by making it a default search via QGIS options -> Locator -> Features In All Layer. Display expressions are defined in the vector layer properties under the display tab. Individual layers can be marked as not searchable in the Project Properties dialog, under the Data Sources tab.
A new indicator "locked" icon is shown for any layers marked as "required" within the current project. This icon gives users instant feedback that a particular layer cannot be removed from the project.
Required layers are configured via the Project Properties dialog, Data Sources tab.
This feature was funded by Arpa Piemonte (Dipartimento Tematico Geologia e Dissesto) within ERIKUS project
This feature was developed by Martin Dobias (Lutra Consulting) and Faunalia
When saving a raster layer to GeoPackage database, it's now possible to append the layer to an existing file.
New functions and logic in QGIS “Value Relation Widgets”, allowing the implementation of complex, dynamic filters within QGIS attribute forms. The functionality can be used to implement “drill-down” forms within QGIS, where the values available in one field depend on the values of other fields:
This feature was funded by QGIS community through crowd-funding
This feature was developed by Alessandro Pasotti (with North Road)
Thanks to a large number of generous backers, a crowdfunded "edit in place" mode was added to Processing for 3.4. When a vector layer is active and editable, this mode allows users to execute suitable algorithms directly on the features from the layer, modifying their attributes and geometries in-place. All edits are added to the layer’s “edit buffer”, so you can easily undo and redo the changes before saving them back to the data source.
For those power users who perform frequent data edits, this functionality is also exposed via QGIS 3.0’s “Locator bar” (that “type to locate” bar which sits in the bottom-left corner). Typing ‘ef’ (“edit features”) followed by the name of the corresponding operation allows you to perform the edits directly via the keyboard. E.g.
Some Processing models are so intrinsically linked to the logic inside a particular project that they have no meaning (or are totally broken) outside of that project (e.g. models which rely on the presence of particular map layers, relations, etc). Accordingly, from QGIS 3.4, Processing models can be stored inside QGIS project files. Any models stored within a project are made available as soon as that project is opened. This also avoids avoid cluttering up the "global" model provider with models which make no sense, and makes it easier to distribute a single project all relevant models included.
Models are stored inside projects by clicking the new "Embed in Project" button in the Modeler dialog toolbar. Models can be removed from a project from the model's right click menu in the toolbox.
This algorithm converts a raster layer into a vector layer, with a polygon feature corresponding to each pixel from the raster and a single field containing the band value from the raster.
QGIS 3.4 adds a native "k-means clustering" algorithm. Based on a port of PostGIS' ST_ClusterKMeans function, this algorithm adds a new cluster ID field to a set of input features which identifies the feature's cluster based on a k-means clustering approach. If non-point geometries are used as input, the clustering is based off the centroid of the input geometries.
This new native algorithm implements an optimised DBSCAN density based scanning cluster approach for clustering 2d point features.
Some miscellaneous improvements to existing Processing algorithms include:
Two new algorithms were added for filtering line/polygon vertices by their M or Z values. A minimum and maximum M/Z value can be entered, and if the vertices fall outside these ranges they will be discarded from the output geometry. Both the minimum and maximum filter values can also be data defined, so can vary per feature.
This new algorithm creates copies of features in a layer, by creating multiple translated (offset) versions of the feature. Each copy is displaced by a preset amount in the x/y/z/m axis.
This new algorithm creates copies of line features in a layer, by creating multiple parallel versions of each feature. Each copy is offset by a preset distance.
When an algorithm has a distance parameter in meters/feet/etc (i.e. non-geographic distances), a combo box has been added allowing choice of the unit type.
(QGIS doesn't (and should never) expose this for distances in degrees -- it's up to users in this situation to choose a suitable local projection and reproject their data to match.)
These two new algorithms can sets geometry vertex z or m values to values sampled from a raster band. Values can optionally be scaled using a (data definable) scale value.
A new "pixels to points" algorithm was added in QGIS 3.4, which creates a point feature at the center of every pixel. nodata pixels are skipped.
This new, much-requested, algorithm returns the portion of a line (or curve) which falls between the specified start and end distances (measured from the beginning of the line). Z and M values are linearly interpolated from existing values.
This new algorithm creates a point geometry interpolated at a set distance along line (or polygon boundary) geometries. Curved input geometries are fully supported. Z or M values are linearly interpolated based on existing values.
When appropriate, scripts will now launch a processing algorithm dialog upon:
A new GDAL provider 'Rearrange band' algorithm was added to the processing toolbox. The algorithm allows to output rasters continuing a subset of a given input raster's bands, and offers the possibility to re-order the bands.
A new option is present for all parameters of using a "precalculated expression". This expression is evaluated once before the child algorithm is executed and used during the execution of that algorithm.
This new algorithm sets a vector layer's renderer to a categorized renderer using matching symbols from a style database.
A specified expression (or field name) is used to create categories for the renderer, with QGIS creating a category for each unique value within the layer. Each category is individually matched to the symbols which exist within the specified QGIS XML style database. Whenever a matching symbol name is found, the category's symbol will be set to this matched symbol.
The matching is case-insensitive by default, but can be made case-sensitive if required. Optionally, non-alphanumeric characters in both the category value and symbol name can be ignored while performing the match. This allows for greater tolerance when matching categories to symbols.
If desired, tables can also be output containing lists of the categories which could not be matched to symbols, and symbols which were not matched to categories.
The new mode "Snap to anchor nodes (single layer only)" makes sure that any two vertices of the vector layer are at least at distance given by the threshold value.
This algorithm comes handy when doing vector overlay operations such as intersection, union or difference to prevent possible topological errors caused by numerical errors if coordinates are very close to each other. After running the algorithm some previously valid geometries may become invalid and therefore it may be useful to run Fix geometries algorithm afterwards.
QGIS is now available as a flatpak application on flathub
Flatpak (formerly xdg-app) is a software utility for software deployment, package management, and application virtualization for Linux desktop computers.
It allows users to install different QGIS versions on linux without having to recompile or use Docker. It is a full package with all libraries included, and it uses its owns user profile locations. So you'll need some disk space and new habits working with flatpak, but it rocks!
Allows SVG images for symbology, labels, etc to be directly embedded inside a project file (or QML style, or QPT print template!) by encoding the svg as a standard base64 string.
Additionally, embeded files can be extracted from projects and symbols and saved back to disk based SVG files.
Mesh layers represent data on variable size grid with extra components (e.g. time and vector). With introduction of MDAL, users can load the following formats directly in QGIS and explore all other components:
With this API, developers can inspect mesh elements and fetch values spatially and temporally. As an example, you can create time series plot from your mesh layer.
A mesh layer often contains several quantities. For example a netcdf/grib can contain several meteorological quantities. Each quantity, can also have multiple components. For example, wind data, can contain speed (scalar) and values (grid). With this option, you can overlay scalar and grids from different quantities. In the image below, you can see temperature (grid) and wind (scalar).
Scalar data are generated usually at the centre/corner of each mesh element. When displaying the scalar data, the arrows might look sparse and often not possible to see the general trend. With this option, arrows can be displayed on a user-defined grid. Extra scalar values will be interpolated on-the-fly and placed on the use-defined grid.
The reading of PostgreSQL JSON types is supported. JSON Data can be displayed in the widgets as "Key/Value" (maps), as "List" (arrays) or as text.
Support has been added to QGIS' Authentication system for ESRI's temporary token based authentication. This allows for connection to ArcGIS Feature and Map Servers via an allocated temporary token.
Recent versions of QGIS have switched to a safer approach to reading SQL Server layers, which automatically checks for geometry validity and repairs geometries when needed. This workaround is required to avoid issues with the design of SQL Server's geometry handling, where encountering any rows with invalid geometries can silently abort a request without returning all the features from a layer. Unfortunately, the workaround comes at a significant performance cost.
In QGIS 3.4 a new setting was added to allow users to manually turn off QGIS' SQL Server invalid geometry handling. Turning on the "Skip invalid geometry handling" setting under a SQL Server connection's properties causes QGIS to skip all the expensive geometry validation processing, but firmly places the responsibility for ensuring that all features on the database have valid geometries back upon the user/database administrator. This is a "use at your own risk" setting. Improperly enabling this option can lead to missing features and data loss.
By default, QGIS Server only caches WMS GetCapabilities document in memory. With WMTS implementation, it is necessary to have a way to cache tiles. But the cache manager has not been developed to only cache tiles.
The cache manager plugin, can be used to cache:
Here is a python cache manager class, which do not verifying if the QGIS project has changed:
class PyServerCache(QgsServerCacheFilter): """ Used to have cache control """ def __init__(self, server_iface): super(QgsServerCacheFilter, self).__init__(server_iface) self._cache_dir = os.path.join(tempfile.gettempdir(), "qgs_server_cache") if not os.path.exists(self._cache_dir): os.mkdir(self._cache_dir) self._tile_cache_dir = os.path.join(self._cache_dir, 'tiles') if not os.path.exists(self._tile_cache_dir): os.mkdir(self._tile_cache_dir) def getCachedDocument(self, project, request, key): m = hashlib.md5() paramMap = request.parameters() urlParam = "&".join(["%s=%s" % (k, paramMap[k]) for k in paramMap.keys()]) m.update(urlParam.encode('utf8')) if not os.path.exists(os.path.join(self._cache_dir, m.hexdigest() + ".xml")): return QByteArray() doc = QDomDocument(m.hexdigest() + ".xml") with open(os.path.join(self._cache_dir, m.hexdigest() + ".xml"), "r") as f: statusOK, errorStr, errorLine, errorColumn = doc.setContent(f.read(), True) if not statusOK: print("Could not read or find the contents document. Error at line %d, column %d:\n%s" % (errorLine, errorColumn, errorStr)) return QByteArray() return doc.toByteArray() def setCachedDocument(self, doc, project, request, key): if not doc: print("Could not cache None document") return False m = hashlib.md5() paramMap = request.parameters() urlParam = "&".join(["%s=%s" % (k, paramMap[k]) for k in paramMap.keys()]) m.update(urlParam.encode('utf8')) with open(os.path.join(self._cache_dir, m.hexdigest() + ".xml"), "w") as f: f.write(doc.toString()) return os.path.exists(os.path.join(self._cache_dir, m.hexdigest() + ".xml")) def deleteCachedDocument(self, project, request, key): m = hashlib.md5() paramMap = request.parameters() urlParam = "&".join(["%s=%s" % (k, paramMap[k]) for k in paramMap.keys()]) m.update(urlParam.encode('utf8')) if os.path.exists(os.path.join(self._cache_dir, m.hexdigest() + ".xml")): os.remove(os.path.join(self._cache_dir, m.hexdigest() + ".xml")) return not os.path.exists(os.path.join(self._cache_dir, m.hexdigest() + ".xml")) def deleteCachedDocuments(self, project): filelist = [f for f in os.listdir(self._cache_dir) if f.endswith(".xml")] for f in filelist: os.remove(os.path.join(self._cache_dir, f)) filelist = [f for f in os.listdir(self._cache_dir) if f.endswith(".xml")] return len(filelist) == 0 def getCachedImage(self, project, request, key): m = hashlib.md5() paramMap = request.parameters() urlParam = "&".join(["%s=%s" % (k, paramMap[k]) for k in paramMap.keys()]) m.update(urlParam.encode('utf8')) if not os.path.exists(os.path.join(self._tile_cache_dir, m.hexdigest() + ".png")): return QByteArray() img = QImage(m.hexdigest() + ".png") with open(os.path.join(self._tile_cache_dir, m.hexdigest() + ".png"), "rb") as f: statusOK = img.loadFromData(f.read()) if not statusOK: print("Could not read or find the contents document. Error at line %d, column %d:\n%s" % (errorLine, errorColumn, errorStr)) return QByteArray() ba = QByteArray() buff = QBuffer(ba) buff.open(QIODevice.WriteOnly) img.save(buff, 'PNG') return ba def setCachedImage(self, img, project, request, key): m = hashlib.md5() paramMap = request.parameters() urlParam = "&".join(["%s=%s" % (k, paramMap[k]) for k in paramMap.keys()]) m.update(urlParam.encode('utf8')) with open(os.path.join(self._tile_cache_dir, m.hexdigest() + ".png"), "wb") as f: f.write(img) return os.path.exists(os.path.join(self._tile_cache_dir, m.hexdigest() + ".png")) def deleteCachedImage(self, project, request, key): m = hashlib.md5() paramMap = request.parameters() urlParam = "&".join(["%s=%s" % (k, paramMap[k]) for k in paramMap.keys()]) m.update(urlParam.encode('utf8')) if os.path.exists(os.path.join(self._tile_cache_dir, m.hexdigest() + ".png")): os.remove(os.path.join(self._tile_cache_dir, m.hexdigest() + ".png")) return not os.path.exists(os.path.join(self._tile_cache_dir, m.hexdigest() + ".png")) def deleteCachedImages(self, project): filelist = [f for f in os.listdir(self._tile_cache_dir) if f.endswith(".png")] for f in filelist: os.remove(os.path.join(self._tile_cache_dir, f)) filelist = [f for f in os.listdir(self._tile_cache_dir) if f.endswith(".png")] return len(filelist) == 0
And the way to add it to the QGIS Server cache manager.
servercache = PyServerCache(server_iface)
QGIS Server 3.4 supports WMTS 1.0.0 OGC standard.
In QGIS project properties, the user can defined:
QGIS Server reused the CRS defined in the WMS for WMTS.
To manage the tile cache, a QGIS Server plugin with a QgsServerCacheFilter class has to be installed and loaded by QGIS Server.
It's now possible to configure QGIS Server to make it write its logs to stderr.
This is done by setting the QGIS_SERVER_LOG_FILE env var to the special value "stderr".
With the offline editing functionality it is possible to select whether the export should create a SpatiaLite or a GeoPackage file for offline usage.
A very fast static spatial index for 2D points based on a flat KD-tree,
Compared to QgsSpatialIndex, this index:
- supports single point features only (no multipoints)
- is static (features cannot be added or removed from the index after construction)
- is much faster!
- supports true "distance based" searches, i.e. return all points within a radius
from a search point
This is an alternative to the ::identify method, which is less
efficient but more powerful
New PyQGIS API has been added to make it easy to retrieve a substring from a LineString/Curve geometry:
QgsCurve::curveSubstring - Returns a new curve representing a substring of a curve, from a start distance and end distance.
If z or m values are present, the output z and m will be interpolated using the existing vertices' z or m values. The method also handles curved geometries without loss or segmentation.
Due to upstream changes within the PyQt/sip library, the recommended way to import this module has changed in QGIS 3.4. For maximum portability, instead of directly calling:
plugins should instead use:
from qgis.PyQt import sip
Using this newer style import will ensure that the code works correct across all platforms and remains functional in future QGIS versions.
Development of the API, a sample provider and tests allowing the creation of vector data provider in pure python.
This feature was funded by Good will
This feature was developed by Alessandro Pasotti