Questions tagged [qgis-3]

for questions specific to the 3.x series of QGIS.

Filter by
Sorted by
Tagged with
0 votes
2 answers
14 views

Exporting every features of a layer as a own layer (using expressions) in QGIS 3.22

I have a Shapefile with different features. Each feature is a Town in a specific region ( in the shape file). I want to automatically export each feature as a its own shape-file. So if the field "...
user avatar
0 votes
1 answer
26 views

Curved labels based on map projection QGIS 3.4

I'm trying to make curved labels based on map projection. Or a labeling style like this: Or like this in world map spherical projection: Is that possible on QGIS 3 ?
user avatar
  • 137
0 votes
1 answer
27 views

Wrap text in a line vector layer QGIS 3.24

I need to wrap labels of a line vector layer. Is there a way to do this in QGIS 3.24 ? I want my labels look like this:
user avatar
  • 137
2 votes
0 answers
24 views

Postgis storage format in QGIS

I have a postgis table with two geometries, a point for a lightning strike and an uncertainty ellipse as a polygon for the lightning strike. I can easily pull each of those geometries into QGIS to ...
user avatar
  • 3,152
4 votes
1 answer
121 views

Converting unique string values to numbers in the attributes field using QGIS

I'd like to convert unique labels C3nv to 1, C3pr to 2, C3rt to 3 and so on using the field calculator. Is that possible or would I need to write a stand-alone script?
user avatar
  • 43
0 votes
1 answer
20 views

Prevent QMessageBar from closing when clicking on hyperlink?

Follow-up from this question: Including hyperlink in QMessageBar Is it possible to stop the QMessageBar from closing when the hyperlink is clicked? A simple messagebar snippet I am using: iface....
user avatar
  • 45
0 votes
0 answers
26 views

QgsDockWidget content gets "squashed"

I designed QgsDockWidget in QtDesigner and it looks like this: But when the plugin is started all the content gets messed up: What can be the possible reason for such behavior? I set minimumSize ...
user avatar
  • 504
2 votes
2 answers
109 views

help(iface.activeLayer.startEditing) question

Beginner here. I am trying to find out what classes some methods are associated with and what those methods do by using the help function for some code im working on as seen below layer = iface....
user avatar
2 votes
1 answer
22 views

Displace close points

I am making a map with some points of interest to be used on our webpages and presentations. Two of these points are so close that they are overlapping if I use big enough points to make them easily ...
user avatar
  • 3,152
2 votes
1 answer
43 views

Docking QGIS Plugin

How to dock QGIS plugin window? I am trying self.iface.addDockWidget(Qt.RightDockWidgetArea, dlg) in run method of QGIS Plugin Implementation class, but the dialog keeps appearing as a floating ...
user avatar
  • 504
1 vote
1 answer
42 views

Error importing QGIS modules in standalone script: from qgis._gui import * ImportError: The specified module could not be found

I'm trying to run the following script (following Gary Sherman's PyQGIS Programmer's Guide). It is supposed to create a standalone PyQT window that displays a .shp in the QgsMapCanvas without opening ...
user avatar
1 vote
1 answer
17 views

Including hyperlink in QMessageBar

Is it possible to include a hyperlink in the messageBar? I used this to create a simple message: iface.messageBar().pushMessage("", 'someHyperlink', Qgis.Info, 0)
user avatar
  • 45
4 votes
1 answer
139 views

Changing label (wrong reverse) direction using QGIS

I use QGIS 3.22.2 and I want to have nice curved labels (along lines): Llyn Brenig Reservoir (currently there are two different labels: Llyn Brenig and Reservoir). Problem is that label Reservoir is ...
user avatar
4 votes
1 answer
37 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?
user avatar
  • 41
0 votes
0 answers
10 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 ...
user avatar
2 votes
0 answers
25 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 ...
user avatar
0 votes
0 answers
24 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 ...
user avatar
3 votes
1 answer
77 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 ...
user avatar
0 votes
1 answer
27 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 ...
user avatar
  • 362
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 ...
user avatar
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 ...
user avatar
  • 163
2 votes
1 answer
124 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 ...
user avatar
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 ...
user avatar
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....
user avatar
  • 175
0 votes
0 answers
24 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 ...
user avatar
  • 362
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': '...
user avatar
  • 362
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: ...
user avatar
  • 362
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 ...
user avatar
  • 11
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 ...
user avatar
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 = ...
user avatar
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 (...
user avatar
  • 163
2 votes
1 answer
47 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;...
user avatar
  • 362
0 votes
1 answer
36 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 ...
user avatar
  • 165
2 votes
1 answer
36 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, ...
user avatar
4 votes
2 answers
75 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 ...
user avatar
1 vote
0 answers
25 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 ...
user avatar
2 votes
1 answer
27 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 ...
user avatar
  • 2,080
1 vote
2 answers
59 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 ...
user avatar
  • 362
0 votes
1 answer
44 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 ...
user avatar
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 ...
user avatar
  • 163
1 vote
1 answer
28 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 ...
user avatar
  • 362
0 votes
1 answer
37 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 ( ...
user avatar
  • 1
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 ...
user avatar
  • 1,018
2 votes
2 answers
67 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 ...
user avatar
  • 45
1 vote
0 answers
35 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 ...
user avatar
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 ...
user avatar
  • 309
2 votes
1 answer
42 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 ...
user avatar
  • 53
3 votes
0 answers
37 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?
user avatar
1 vote
1 answer
49 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 ...
user avatar
  • 175
0 votes
1 answer
42 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 &...
user avatar
  • 1,279

1
2 3 4 5
79