New answers tagged

0 votes

Set a relative path for PDF linking to shapefile

Using QGIS expression with function file_path() and variable @layer, you get the path of the current layer: file_path (@layer). Concatenate this with the filename to get what you want, using function ...
  • 55.5k
1 vote

Using QGIS processing algorithms in C++

QgsApplication::processingRegistry()->addProvider( new QgsNativeAlgorithms( QgsApplication::processingRegistry() ) ); QgsProcessingContext context; context.setProject(QgsProject::instance()); ...
0 votes

Why Travelling Salesman Problem plugin is not working in QGIS 3?

You can install it via zip file for QGIS 2 using the answer from: How do I install a plugin when I have the .zip file for it
1 vote

Why Travelling Salesman Problem plugin is not working in QGIS 3?

I'd recommend you to stick to ORS Tools plugin, as it supports, amongst other tools and functions, TravellingSalesmanProblem: https://github.com/GIScience/orstools-qgis-plugin
0 votes

Check geometries distorting polygons when removing gaps

Maybe it depends on the tolerance, try putting a value of 1E-8
  • 4,154
0 votes

View KML Feed in QGIS

I got this to work by downloading the data rather than using the live view. At the top left of your screenshot, it says "Found 333 sites" and then there are two buttons. The first downloads ...
0 votes

Serve PostGIS data using QGIS Server

Following to my previous message, I'm sharing my error. I am unable to serve a project containing postgis tables. For a first test, I'm just trying to serve one of the tables contained in my project. ...
  • 839
8 votes
Accepted

Extract points from a selected polygon in model builder [QGIS 3.30]

This can be achieved very simply by using the Extract selected features algorithm:
  • 12.3k
2 votes

Qgis server : install QWC2 and Lizmap on the same server?

The only common part between these two projects is QGIS server and the web server (Nginx/Apache). I don't see any blocker using the same QGIS server, for testing purpose. The Lizmap QGIS server plugin ...
  • 6,721
6 votes

Show discrete values on legend from layer with Singleband Pseudocolor (PyQGIS 3.22)

You don't set minimum/maximum values. This is why you get the wrong legend. When using GUI, QGIS does it itself. min_ = stats.minimumValue max_ = stats.maximumValue .... renderer = ...
0 votes

Serve PostGIS data using QGIS Server

To define and serve your PostGIS data just use it as a layer within project (the same way as you use shapefile data). LAYERS parameter is needed in WMS request to define which layer from server you ...
  • 79
2 votes
Accepted

Cannot find QuickOSM plugin in QGIS 3.28

The plugin is indeed installed, but not enabled.
  • 6,721
0 votes

QGIS Server installation (Debian) : error message

Problem fix thanks to this post : https://lists.osgeo.org/pipermail/qgis-user/2023-March/052763.html There was a big typo in the official doc... How to point out this big error in the doc which ...
  • 839
0 votes

QGIS crashes when using Interpolation (TIN) from Python Console in QGIS, but works well when using GUI

There's no attribute named 'vectorLayer' in layerData. Try to change it to 'source'. layer_data.source = layer #instead .vectorLayer
1 vote

Fields and value symbology rule-based expression in QGIS

I agree with others that the question isn't very clear. Whether categorized, graduated, or rule-based; the same expression should work: if( lower("retention") = 'retain', "tpz&...
  • 1,683
2 votes

Fields and value symbology rule-based expression in QGIS

If i understand your question, you can put the symbology logic without conditions in the formula, and put an expression in the opacity, expression base on the other field like : if (retention = a ...
  • 576
4 votes

Is there a way to access named PostgreSQL connections via PyQGIS in order to access and load spatial layers?

Ah I think I actually figured it out from this page: Getting schema names from PostGIS database in PyQGIS For connections that exist, you can use: md = QgsProviderRegistry.instance().providerMetadata('...
  • 79
7 votes

Is there a way to access named PostgreSQL connections via PyQGIS in order to access and load spatial layers?

Try this. I have a connection called localhost data so I search for the word data in all the PostgreSQL connections: from PyQt5.QtCore import QSettings qs = QSettings() L = [] for k in sorted(qs....
  • 61.3k
0 votes

"Save Map As Image" in QGIS 3.2?

QGIS vs 3.3 Project; Import/Export; Export map to image/pdf/dxf
3 votes

Difference between QGIS download and OSGeoW4 Network installer

The OSGeo4W installer shows what QGIS versions can be installed. It is possible to install different versions of QGIS with the installer QGIS desktop (latest release) QGIS-dev (nightly build) QGIS ...
  • 59.2k
5 votes
Accepted

Set fixed reference scale for QGIS layer with PyQGIS?

You can set a reference scale by getting the renderer of the active layer. You don't need to make a new QgsFeatureRenderer. lyr = iface.activeLayer() r = lyr.renderer() r.setReferenceScale(400_000)
0 votes

GDAL processing output to memory in Pyqgis

You can use "OUTPUT": QgsProcessing.TEMPORARY_OUTPUT
  • 9,977
1 vote

Setting the study area boundaries in QGIS for nearest neighbor analysis?

I have written a script based on the standard NNA tool which takes point and polygon features as input and performs NNA for each of the polygons using the points within. It also uses polygon area as ...
0 votes

Moving node in QGIS?

If the layer in which you want to edit the vertices has symbology, sometimes QGIS seems to only allow you to select the vertex (shown with a blue circle), but not to move it. I solve this situation by ...
3 votes

Calculate grid cells enter/exit timings from overlayed timed route

In QGIS 3.22 there is the option to rasterize 3D lines, interpolating the vertices (Burn value extracted from the “Z” values of the feature): https://docs.qgis.org/3.22/en/docs/user_manual/...
9 votes

Creating spatial index in standalone script as part of output vector layer using PyQGIS

If you use layer_out.dataProvider().createSpatialIndex() you don't get that error. To get the error you must use layer_out.createSpatialIndex(). The code in the question doesn't throw the error: ...
3 votes
Accepted

Save a layer's renderer to 'undo' the changes in style

Some objects accessible in the QGIS Python API are tricky to handle as their actual lifespan might differ from what you'd expect as a Python user. In Python, objects usually exist until there is no ...
  • 9,977

Top 50 recent answers are included