Hot answers tagged

6 votes
Accepted

Changing symbol by expression in QGIS

You can set an expression by clicking the expression button as shown below. Then click the edit option. and calculate an expression that look like this, you can find the names of the symbols by ...
user avatar
  • 1,107
4 votes
Accepted

Plotting two sets of XY coordinates from same vector import file

Yes, you can do this. In the symbology, add a new layer (press the green +), set the type as Geometry Generator, make sure geometry type is point / multipoint and that unit is map unit and type in ...
user avatar
  • 2,895
3 votes

Extract Single (or small number) Contour from DTM data in QGIS

QGIS is using this GDAL utility https://gdal.org/programs/gdal_contour.html and it has an option to create contours not for intervals but for a fixed set of levels -fl Name one or more “fixed levels”...
user avatar
  • 52.5k
3 votes
Accepted

Extract Single (or small number) Contour from DTM data in QGIS

You can use r.contour: Produces a vector map of specified contours from a raster map.
user avatar
  • 52.5k
2 votes

Calculating max and min pixel values for numerous overlaying rasters in QGIS

Create a Minimum raster of all the layers > Create a Maximum raster of all the layers > Create a Difference raster of the 2 MIN and MAX Rasters. Create a raster of MINIMUM pixel values for ...
user avatar
  • 1,738
2 votes
Accepted

Creation of datasource failed (OGR error, unable to open database) using PyQGIS

The error message says that the database driver is not able to create the file it should be writing to. In my experience, this is usually caused by one of three problems: Trying to write to a write ...
user avatar
  • 2,895
2 votes
Accepted

Converting QGIS feature selection into dataframe to allow plotting

The selected data, although looking more complicated when viewed, was ready to directly go into a dataframe. import pandas as pd import plotly.express as px layer = qgis.utils.iface.activeLayer() sel=...
user avatar
  • 127
1 vote
Accepted

Duplicated attributes problem while adding attributes of points to attribute table of lines in QGIS

Open the field calculator in the lines layer and calculate the fields with this expression. For the start of the line: aggregate( 'Points', -- replace Points with the points layer name/id '...
user avatar
  • 1,107
1 vote
Accepted

Create attribute in a field based on the part of the name of a file in a folder with Python in QGIS

There are a several problems with your script which I would like to try to help you understand. Firstly, trying to apply the syntax which works in a feature action is the wrong approach. In the action ...
user avatar
  • 14.5k
1 vote

Get coordinates from a second layer

Lets say you have a point layer and want to get the coordinates of the nearest point on the line layer. Use this expression for x-coordinate and replace x by y for y-coordinate: x ( closest_point (...
user avatar
  • 41.1k
1 vote

Create reference number based on direction of line

Manually draw a direction line. It can be simply drawn with few vertices, see my dotted red line below. Densify this by interval to create vertices with short interval. My red line is 6000 m, I use 50 ...
user avatar
  • 52.5k
1 vote
Accepted

Adding PostGIS mixed-geometry layers in standalone QGIS scripts the same way as QGIS GUI?

To load geometries from a mixed geometry table you need to specify the geometry type using the type parameter in the data source URI. This is possible using setParam(): uri = QgsDataSourceUri() uri....
user avatar
  • 1,734
1 vote
Accepted

Adding "Draw on canvas" option for the input box of Qgis Graphical Modeler

Here is a PyQGIS solution (in the form of a custom processing script) which should do what you are asking. This script algorithm has two optional input parameters. The first is a ...
user avatar
  • 14.5k
1 vote
Accepted

QGIS : EPSG4326 : arc of circle with X radius centred in Z (aviation)

Your problem stems from the use of EPSG:4326 when generating your arc. While 4326 is fine for locating point data, it should not be used with anything that involves distance or area (including line or ...
user avatar
  • 7,069
1 vote
Accepted

PYQGIS MapLayerComboBox filter on both layer type and field within layer

You can use the following approach which is to make use of the setExceptedLayerList() method of QgsMapLayerComboBox and pass a list of layers which will not be shown in the combo box. The basic logic ...
user avatar
  • 14.5k
1 vote

Split with Lines not splitting polygon in QGIS

Not entirely sure what went wrong. The line was listed as one feature and was created in a continuous fashion. However, when I tried copying to the new scratch file, it pasted as 5 separate lines. I ...
user avatar
1 vote

Navigating attributes tables with arrows keys in QGIS

You could change the widget type from "Range" to "Text edit" in layer's Properties -> Attributes Form. You should modify the form type from "Autogenerate" to "...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible