Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Articles by QgsExpression ContextUtils
Empty @layer_name variable in QGIS expression using the "Geometry by expression" tool
This is a bug (#54869) with no workaround other than hardcoding the layer. An alternative to using the native (C++) Geometry By Expression tool is to modify the old python Geometry By Expression tool from QGIS 3.10 and add the missing layer scope to the expression context using QgsExpressionContextUtils.layerScope.
Why PyQGIS is not calculating the square root correctly in this expression
I have a shapefile with ~100 fields, the first ~50 fields are motion towards the east, and the last ~50 are motion towards the north. There are 50 fields because each represents a date. I want to calculate the displacement using a simple formula (d= sqrt((east * east)+(north * north)). Below is a sample of the shapefile As I need to repeat this at least 50 times I am using the Python script in QGIS to create and calculate the new fields.
Problem joining two python scripts + QMessageBox + Chi-square + vector tools
I created a model that combines two vector layers and outputs a single layer with aggregated data, after that, is calculated chi-square test. I tried join both, but I can´t. Now, when it´s executed, it crash QGIS. Could someone look it? """ Model exported as python.
Performing the same mathematical operation on many attributes at once with QGIS
I can suggest a PyQGIS approach. It utilizes the $area function inside the QgsExpression() class. Let's assume this is an attribute table of the original 'lines' layer, see the image below.
Running Python code easily for end users in QGIS
You can use the minimal plugin skeleton in this repo. Copy the files (only metadata and __init__ are required) to a new folder in plugin folder.
Show More
loading
Actions
Is this you?
As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.Get in touch with QgsExpression
Contact QgsExpression, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack