Skip to main content
18 votes
Accepted

Show images related to features in QGIS?

Can be done on identification. You first need an attribute with the photo paths. Must be full path: Then you set the widget of the attribute to Photo, through the image properties: When you ...
HeikkiVesanto's user avatar
  • 16.9k
10 votes
Accepted

Action to directly export selected features as GPX

If it were a single feature to export you could use an action with canvas scope (i.e., interacting with the canvas), but since you may export several features, an action with layer scope fits better. ...
Germán Carrillo's user avatar
8 votes

Show images related to features in QGIS?

This is also possible through layer styling by using a combination of a Geometry generator to create rectangular polygon placeholders for the image, and then Raster Image fill to insert the images. ...
Andy Harfoot's user avatar
  • 3,427
8 votes
Accepted

Creating QGIS copy-paste features between two layers using PyQGIS?

To copy all features; create a list, get features from source layer, create data provider on destination layer, and finally add features to destination layer: sourceLYR = QgsMapLayerRegistry.instance(...
artwork21's user avatar
  • 35.2k
7 votes
Accepted

QGIS actions: copy to clipboard some attributes

You could choose action-type Python and do something like this: from PyQt4.Qt import QApplication clipboard = QApplication.clipboard() clipboard.setText("[% "name"%]"+","+str([% "myintegerfield"%]))
Thomas B's user avatar
  • 8,936
7 votes
Accepted

QGIS action for inserting text in field by hotlink

If you change the Type from Generic to Python, you could use the following instead: layer = qgis.utils.iface.activeLayer() layer.startEditing() idx = layer.fieldNameIndex('Process') layer....
Joseph's user avatar
  • 76.3k
7 votes

Creating multiple select dropdown list in QGIS

First I recommend to use QGIS 3.4.2, because QGIS 2.18.26 did not provide the desired results. If your species data are saved in a CSV file, load the data into the QGIS as a table from Add vector ...
ahmadhanb's user avatar
  • 41.4k
7 votes
Accepted

Open specific page of a PDF using QGIS actions

You can use the following Python action: import subprocess import os path_to_pdf = os.path.abspath(r'[% "path" %]') # path of your pdf file in the field path path_to_acrobat = os.path....
Vincent Bré's user avatar
  • 4,120
7 votes
Accepted

Importing .py script to action editor using QGIS

[% $id %] is special QGIS syntax for "before sending this text as code to the Python interpreter, insert the value of the QGIS expression $id" here. A Python interpreter does not know about ...
bugmenot123's user avatar
  • 11.3k
6 votes

Show images related to features in QGIS?

This can also be done using "Map Tips". You have to add the URL to the attribute table like Vesanto did. You go to "Layer Properties" --> "Display", there you switch to html and add something like &...
AndreasK's user avatar
  • 1,245
6 votes

Filling fields instantly and automatically when creating new entity in QGIS

Please take a look at the aggregate function of the field-calculator. In the layer properties the tab attribute form (8th from the top) you may set standard/preset values for your fields, e.g. based ...
Erik's user avatar
  • 17.1k
6 votes
Accepted

QGIS Actions in QField

For now, QField does not recognize clickable URL. An issue has been reported on GitHub, let's wait for this enhancement.
Elvis Gunther Dahnert's user avatar
5 votes

How to add a new feature to a layer

You must declare the feature's fields before being able to use them: lyr = QgsMapLayerRegistry.instance().mapLayer('layer') fields = lyr.pendingFields() new_feat = QgsFeature(fields) new_feat....
JGH's user avatar
  • 43.1k
5 votes
Accepted

Zoom Canvas to Selected Features with Python call from QGIS Layer Action

Try this code snippet to zoom to selected features of the layer: canvas = qgis.utils.iface.mapCanvas() canvas.zoomToSelected(layer) # zooms to selected feature extent for layer
artwork21's user avatar
  • 35.2k
5 votes
Accepted

Developing QGIS Action which loads a raster

Try using the following code in your Action Text which should do the following: Keeps your 'catalogo_CTR' layer as active Creates a new group to contain the raster layers if one does not exist Sets ...
Joseph's user avatar
  • 76.3k
5 votes
Accepted

Open multiple files at once by QGIS actions buttons

You can define a action type "Python" and then use a little python script to open multiple PDFs at once. In this example I have an attribute named 'path' which holds the path information. Be aware ...
eurojam's user avatar
  • 11.9k
5 votes

Making button clickable to perform function in Leaflet?

If you look at the definition of leaflet-bottom style: .leaflet-bottom { position: absolute; z-index: 1000; pointer-events: none; } you'll see it has pointer-events: none property. ...
TomazicM's user avatar
  • 27k
5 votes
Accepted

Making button clickable to perform function in Leaflet?

I think the method "flyTo" is case-sensitive. Try it with a capital T. map.flyTo([43.372000,-80.987697], 13); Here is an example to demonstrate that it works with a capital T but not with a ...
cmrRose's user avatar
  • 1,150
5 votes
Accepted

Editing feature geometry in action using PyQGIS

Solved. Since v3.0, QGis has a changeGeometry method in the layer itself, which does use the edit buffer and so plays nice with the form calling the action. It just hasn't made it into the Python ...
Houska's user avatar
  • 8,416
5 votes

Creating an QGIS Action to change a field value from yes to no

You can use a simple Python action to do just that. Open the layer properties dialog for your point layer and click on the 'Actions' tab. Click on the green cross to add a new action and configure the ...
Ben W's user avatar
  • 23.1k
5 votes
Accepted

QGIS action on layer scope - reference to layer

I have used this approach in Python actions previously to get a reference to a QgsMapLayer object and it works well: layer_id = '[%@layer_id%]' layer = QgsProject().instance().mapLayer(layer_id)
Ben W's user avatar
  • 23.1k
5 votes
Accepted

QGIS - Python Action Error

QGIS uses the Python environment installed by itself. You have to install packages to Python 3.7 installed by QGIS installation. Open OSGeo Shell Run py3_env Run pip install pandas
Kadir Şahbaz's user avatar
5 votes

Determining source of QGIS Action

QgsVectorLayer class has featureAdded signal. First, you need to connect it to a new method which has one parameter (feature_id here) which grabs the newly added feature id. In edit mode, this id is a ...
Kadir Şahbaz's user avatar
5 votes
Accepted

AttributeError: 'QgsFieldComboBox' object has no attribute 'setPlaceholderText'

The QGIS widget classes do inherit from the standard Qt classes most of the time. In this case QgsFieldComboBox inherits QComboBox, but the issue most likely is that the setPlaceHolderText method was ...
CodeBard's user avatar
  • 3,699
5 votes
Accepted

Loading raster layer from URL in QGIS Attribute table

As action type choose Python instead of Open URL. Make sure to add the missing dot in your code between iface and addRasterLayer and to reference the correct field (in your screenshot it says "...
MrXsquared's user avatar
  • 35.6k
4 votes
Accepted

how do I view geotagged photos and audio points in qgis mac?

On a Mac running QGIS 2.18.2, it is possible to setup a qgis action to open these two media types using the mac qlmanage (quicklook) application that is native to MacOS. For QGIS 3.6, there is a ...
jamierob's user avatar
  • 1,603
4 votes

Show images related to features in QGIS?

It works with "Forms" if you have an attribute for your image file. The pathname can be relative. In QGIS 3.30.0-'s-Hertogenbosch, I have a points layer with a field for a local filename, ...
Dave X's user avatar
  • 1,724
4 votes
Accepted

Filling fields instantly and automatically when creating new entity in QGIS

QGIS 3.6.2 - Noosa This will generate a memory layer of a spatial join between the polygon layer being edited and an existing points layer. The fields to be joined can be specified with the ...
Matt's user avatar
  • 17.9k
4 votes
Accepted

Using Layer Actions on overlapping polygons with PyQGIS

Firstly I must admit I have never really delved into Actions before now, so based on discussions in comments below and my own experimentations, I have heavily revised my original answer. My test layer ...
Ben W's user avatar
  • 23.1k
4 votes

Placing plugin or action in submenu using PyQGIS or PyQT

It can be improved (tests, search of the submenu text) but the code below will add your action in the right Geoprocessing Tools submenu : def add_plugin_to_geoprocessing_menu(action: QAction) -> ...
J. Monticolo's user avatar
  • 15.9k

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