Questions tagged [qgis-3]
for questions specific to the 3.x series of QGIS.
3,921
questions
1
vote
1
answer
8
views
QGIS 3 Modeler operate with a fieldname
In a model I would use a fielname of a layer with the Inout of Vector Field. When I use the the name of the input in an expression the model gives no result. Do you have any idea?
0
votes
0
answers
7
views
QGIS2Web for MapBox output - png file displays upside down
I am using QGIS2Web to generate web maps from data in Ireland. I have gone through this process with leaflets, but now I am trying Mapbox output. The 'background' is a raster file of hillshading. I ...
2
votes
0
answers
15
views
Have voronoi take into account line boundaries (such as rivers, highways...) (on Qgis 3.14)
I have points locating supermarkets. I would like to use the Voronoi method to automatically delineate the catchment area of each supermarket (in real life of course it overlaps a bit on each other ...
0
votes
0
answers
17
views
PyQGIS how to set value for canvas buffer? setExtentBuffer doesn't work?
I'm trying to set a buffer value for a canvas setExtentBuffer(100.0).
canv = iface.mapCanvas()
canv.mapSettings().setExtentBuffer(100.0)
print(canv.mapSettings().extentBuffer())
But when checking the ...
3
votes
1
answer
70
views
Select feature by expression and run "native:buffer" on selection, works for "id" field but no other field in PyQGIS
I'm trying to select features from a polygon layer where a specific string value ('yes') is found in a field called "result" and buffer them. My script can select features with a specific ...
0
votes
1
answer
26
views
Unable to save KML file using QgsVectorFileWriter
I am using this code:
default_filename = Path.home() / "Documents/test.kml"
outputlayer, _ = QFileDialog.getSaveFileName(self, "Save KML file", str(default_filename), "KML ...
1
vote
1
answer
24
views
Unlocking scale with PyQGIS
I'm making a script that uses canvas.zoomScale(550_000, False) zoom.
However, if the user is zoom-locked, the script will run incorrectly, but it will not give any error.
Is it possible to somehow ...
0
votes
1
answer
26
views
PyQGIS cannot set proper symbol color
I have created a script to run inside QGIS via the Script Runner. It works by checking if a layer is already present. If so, it just reloads the layer but if the layer is not present it loads the ...
2
votes
1
answer
122
views
I can't merge two vector layers due to their fid field
I have two vector point GeoJSON layers) showing supermarkets in 2 adjacent cities. I would like to combine them in one way or another (by merging them or adding the feature of one to the other). Their ...
1
vote
0
answers
26
views
Work (see) in the workspace with the exact elements in a print layout in QGIS 3
Is there any possibility to see (to work with) exactly what you get in a print layout in QGIS 3?
I have an A3 layout, at 1:45000 scale, but i cannot arrange all elements because I get a different ...
0
votes
0
answers
25
views
No output from saga:polygonselfintersection process in PyQGIS
I'm trying to use the saga:polygonselfintersection process in my script but only the .prj file is saved in the output. When I'm using the process in a testscript in the python-console its working fine....
0
votes
0
answers
23
views
Prevent 'Stop Editing' popup from showing when editing mode is toggled PyQGIS
In my plugin, when the user adds a feature, I am committing the changes in code, so when the user clicks the 'done' button, there is no need for the popup that asks the user if they want to save ...
1
vote
1
answer
38
views
Using variable in QgsDefaultValue() of PyQGIS
This is not working for me:
# set default values
fields = {
'target_geometry_set_id': self.poly_set_id,
'target_geometry_type': 'Polygon',
'target_geometry_source': '...
1
vote
1
answer
25
views
Auto populating attributes when feature added instead of edit form popping up using PyQGIS
In my plugin, the user can go into add feature mode:
self.poly_layer.startEditing()
iface.actionAddFeature().trigger()
And I can suppress the edit form from popping up by doing this:
...
1
vote
1
answer
22
views
How can I know the length of a line with different weight depending on a raster?
How can I know the length of a line with different weight depending on a raster?
I have a line that crosses some areas with different environmental weight.
The values of the different areas in the ...
0
votes
0
answers
33
views
Rule Based Symbology
I am using QGIS 3.16 version. I used this expression $id=@atlas_featureid for my inside features and $id!=@atlas_featureid for my outside features filter in rule based symbology and my layers ...
1
vote
1
answer
87
views
Change XYZ tile to Color Rendering to Grayscale
I want to change Color rendering of the XYZ tile(namely google satellite). In case of raster image we can easily convert using following code.
layer = iface.activeLayer()
myGrayRenderer = ...
0
votes
0
answers
16
views
pyQGIS script 'not a valid or recognized data source'
I have been running pyQGIS scripts successfully using the plugin Script Runner. Now I am trying to adapt the scripts to run outside QGIS (a standalone script).
Following the pyQGIS cookbook (...
2
votes
1
answer
46
views
Getting geometry from attribute using PyQGIS
I am using PyQGIS 3.
I pull in a line table from postgres database. and one of the attributes is a point geometry, when I open the attribute table that column shows data in this format:
SRID=4326;...
0
votes
1
answer
35
views
Strange "TypeError: string indices must be integers" when refactoring fields (processing.run()) in PyQGIS
I wrote a small function to refactor fields (just one field really) in a given Shapefile which I output as a temporary layer. In principle it works just fine. I build a String with all the info the ...
2
votes
1
answer
33
views
Generating discrete legend labels instead of default maximum and minimum label on single bar - QGIS 3.18 to 3.22
Question:
I used a python script in QGIS 3.16 to generate a raster and subsequently a print layout with legends. I am trying to use the same script to build the print layout in QGIS 3.22. However, ...
4
votes
2
answers
72
views
Replacing column of comma separated strings of IDs with values stored in another field based on those IDs using QGIS
I have a layer with three columns:
geoid: ID of each polygon (string)
totpop: Total population of each polygon (integer)
neigh6: Comma separated list of the IDs of polygons that neighbor that polygon ...
1
vote
0
answers
24
views
Using Filter-Argument in Sum-Expression
I am a QGIS-Newbie who is trying to get familiar with the Field-Calculator.
I want to sum up the "Length" of all objects with "Calc-ID" of value 1.
I know it is possible to select ...
2
votes
1
answer
24
views
Filter visibility of map features based on Atlas Coverage Layer geometry or attribute
When creating an atlas in QGIS, is it possible to filter map feature visibility based on the coverage layer?
What I want:
Using the image below, I want to hide the orange polygons and display only the ...
1
vote
2
answers
57
views
Open attribute edit when feature is selected using PyQGIS
For my plugin I want the user to be able to select a feature and an edit window popup for editing a certain attribute of that feature. I could do this by making a QInputDialog.getText show up when a ...
0
votes
1
answer
37
views
Python editing of QGIS layer metadata
I want to feed metadata (title, attribution, etc) to a lot of raster layers in a QGIS project. From what I have read, I managed fine to get hold of metadata from the QGIS python console, using simple ...
0
votes
1
answer
36
views
PyQGIS save a project and close a project - QGIS v3
Using PyQGIS with QGIS v3
My script opens an empty QGIS project (thinking this would retain the path).
I add some layers, perform a few tasks. All is good.
Now I want to close the project or I should ...
1
vote
1
answer
27
views
How to display text attributes on map canvas PyQGIS 3
I have a layer of lines which has certain attributes:
There is the label attribute which will contain text, and the label location attribute which will be a point geometry.
How can I make the text ...
0
votes
1
answer
36
views
Shortest distance between points and line
I am looking for the shortest distance between "n" points and lines.
I've been searching (I'm new to Qgis) and I get the expression:
length( make_line ( $geometry, closest_point ( geometry ( ...
1
vote
2
answers
31
views
How do I make an exact copy of my QGIS3 installation on another pc? [duplicate]
I am working on several computers with QGIS3 (Windows 10, QGIS version 3.18.2-Zürich) and I want to synchronise my installation configuration on all computers, so that they are the same.
This would ...
2
votes
2
answers
65
views
Deselecting layer using PyQGIS
I can select a layer using:
lyr = QgsProject.instance().mapLayersByName( "lyr_name" )[0]
iface.setActiveLayer(lyr)
This selects and highlights the layer in the table of contents.
How can I ...
1
vote
0
answers
32
views
How to show the profile of a ZPolyLine with QGIS 3.26 profile tool
I am trying out the new QGIS 3.26 profile tool. (actually a Linux build of today's master: 2f3d6b, so 3.27)
I imported a SRTM DEM.
I can create a ZPolyLine and use it to plot the Terrain Elevation of ...
0
votes
0
answers
24
views
No localization possible for ESRI-layer with CRS 4647 (QGIS 3.22)
I have a point ESRI-layer with CRS 4647, it should show special points along rivers in my region. When I open it in an existing QGIS (3.22) project (CRS EPSG 3044 or EPSG 25832), I do not see any ...
2
votes
1
answer
41
views
Duplicated attributes problem while adding attributes of points to attribute table of lines in QGIS
I am trying to add the id numbers of my points to the attribute table of my lines.
I used this post [https://gis.stackexchange.com/a/355320], which solves the problem. However, the resultant layer has ...
3
votes
0
answers
35
views
QGIS read only Project?
I'm creating a project, but I don't want others to have permission to modify the project. So i want to create a read-only project in QGIS3.16.14, is it possible?
1
vote
1
answer
38
views
Creation of datasource failed (OGR error, unable to open database) using PyQGIS
In my script I'm trying to save some vector layer after processing it. In the rest of the script it works fine but in this section (after the if condition) I keep getting an error, no matter in which ...
0
votes
1
answer
39
views
Value relation: Use multiselections together with auto completer
During fieldwork I want to select from 1 to up to 70ish species from a list of appr. 400 species.
The value relation widget works fine in both QGIS and QField.
This widget gives me the opportunity to &...
1
vote
0
answers
50
views
Add magnetic declination to print composer
Is it possible to let the QGIS print composer calculate the magnetic declination at the current map area and just display the value in the corner of the map? I have searched a lot but did not find any ...
3
votes
1
answer
99
views
Create attribute in a field based on the part of the name of a file in a folder with Python in QGIS
I have a common path (F:\Comune) where there are folders with name that corresponds to the attribute of a field of the vector Zp.gpkg called "Numero".
The field "Numero" for every ...
1
vote
0
answers
27
views
Cannot undo or redo (greyed out 95% of the time)
QGIS is amazing, but I cannot undo or redo on basic actions. Here is only one example.
I have 5 layers in my project, and I turn one layer off. I cannot undo with control + z or edit>undo.
I am on ...
2
votes
1
answer
34
views
Calculating max and min pixel values for numerous overlaying rasters in QGIS
I have over 1000 interpolated raster layers. I'm trying to use QGIS 3.16 to create a confidence interval map by finding the difference between the highest and lowest values at each pixel and creating ...
2
votes
1
answer
44
views
setDataSource() not working with query PyQGIS 3 [closed]
uri = QgsDataSourceUri()
uri.setConnection(aHost=self.db_conn.host, aPort=str(self.db_conn.port), aDatabase=self.db_conn.database, aUsername=self.db_conn.user, aPassword=self.db_conn.password)
...
2
votes
1
answer
74
views
Get coordinates from a second layer
I'm using QGIS 3.16.
I have to get coordinates from a line-layer (layer_1) and write them to a point-layer (layer_2). I cannot create the coordinates in layer_1 because i am not allowed to create any ...
1
vote
0
answers
27
views
Authentication problem PostGIS - QGIS
I am using PostGIS as the main data storage for QGIS with stored login credentials. This works great, with one exception: For some layers, QGIS starts asking me for login credentials to the QGIS ...
0
votes
0
answers
16
views
Alternative to PointsToPath in QGIS 3 to link point geometries based on integers (ranking, dates etc.)
I am looking for a QGIS 3 alternative to the QGIS 2 plug-in PointsToPath, which allowed the linking of points based on an order provided in a simple integer column. I would like to create simple maps ...
0
votes
0
answers
14
views
Using Processing Algorithm script QGIS3 outside GUI [duplicate]
I get an error when I try to use a Python script using processing algorithms.
If I use the following script, the program will encounter an error. So there is no processing.
import processing
...
1
vote
0
answers
17
views
Labelling / symbolizing layers using QGIS [closed]
I'm realizing the same analysis on specific layers on QGIS.
I need to display a specific information (like showing code "xxx", then "yyy", then "zzz" etc.) and export ...
1
vote
0
answers
53
views
Taking vertices and using point to path creates a mess, how can I snap the lines to roads?
I’ve tried points to path (and various other processing tools) however I end up with this:
When really it should look more like this line string
(without the gaps separating chunks of road here and ...
0
votes
1
answer
39
views
Create reference number based on direction of line
I'm looking to label a series of lines based on a direction of the trail rather than any cardinal direction (east to west, north to south, etc.) in QGIS 3.4 for Windows 11.
For example, let's say I ...
3
votes
1
answer
85
views
Changing symbol by expression in QGIS [duplicate]
The same way we can define the color of symbols using expressions, do you know if we can change the symbol itself in QGIS 3.24?
In my situation, I use a layer 'OPTIONS' to change values on the map, ...