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 ...
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.
...
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. ...
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(...
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"%]))
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....
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 ...
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....
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 ...
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
&...
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 ...
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.
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....
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
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 ...
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 ...
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. ...
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 ...
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 ...
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 ...
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)
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
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 ...
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 ...
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 "...
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 ...
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, ...
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 ...
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 ...
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) -> ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
actions × 117qgis × 91
pyqgis × 31
python × 18
qgis-3 × 7
attribute-table × 7
fields-attributes × 6
hyperlink × 6
qgis-plugins × 5
qgis-2 × 4
pdf × 4
qfield × 4
pyqt × 3
raster × 2
postgis × 2
layers × 2
export × 2
vector-layer × 2
file-path × 2
url × 2
shortcuts × 2
button × 2
menu × 2
arcgis-desktop × 1
polygon × 1