Couldnt find a solution for QGIS 2 using only expressions, I guess a custom function to get the current map extent is needed for this version (similar to item_variables('Map 1')['map_extent'] in QGIS 3).
However, just in case someone is looking for a solution in QGIS 3, here is an expression:
intersects( -- check if atlas layer and map extent intersect ...
You can use the feature filter in layer properties -> source -> query builder:
E.g. use $id < 51 as expression to only show the first 50 features. Or use "population" > x to display only vilages with a population greater than x.
In QGIS 2.18 you can find the same menu in layer properties -> general -> query ...
What you seem to mean is how often does each line cross the boundary (outline) of each polygon. When a line crosses a polygon, the number of intersection points is infinite as the intersection has the form of a line and this consists of an infinite number of points.
To count the number of crossing points with the boundary, first convert your polygons to ...
I'm not an expression expert. My solution uses a custom function.
from qgis.core import *
from qgis.gui import *
def randstr(in_list, feature, parent):
randstr('A', 'B', 'C')
You can try an expression like this:
Explanation: First set up an array as variable, so you only have to build your lookup-array once. Next we pickup a random position from this array using array_get() combined with rand(). The ...
This solution relies on two relatively new functions of QGIS expressions: array_sum(), avalilable since QGIS 3.18 and overlay_nearest(), available since QGIS 3.16.
Calculate the total length of the roads per province.
Calculate the length of the percentage you want to get. In my example, the total length is 1090566 m, 10% thus is 109056.6 m
Remark: see ...
Not sure I understood well (if you want to count occurrence from column field3 or if it's the column you want to fill with a count from another column).
I have considered you want to update the field3 using count from field1. In this case, you need to try the following expression to update field3 with count of occurrences from field1 using QGIS field ...
You can use a one-step expression using count() function:
count("ID","CLASS") / count("ID") * 100
This will return the percentage of the current class of the total feature count.
Where "ID" is a unique field and "CLASS" an identifier for your class, so not unique.
If you need an overview-table, you can run ...
The solution is to use the function aggregate().
I did it in a two-step process:
Tool Aggregate with count as aggregation, and subsequently tool Field Calculator with the following expression (where count is the attribute respectively column created with the Aggregate tool):
"count" / aggregate(layer:=@layer, aggregate:='sum', expression:="...
The problem is that you expect that make_ellipse returns an ellipse in EPSG:26913 coordinates. Yes, it returns EPSG:26913 coordinates (big numbers like 500000 which are projected coordinates), but QGIS considers those are in source layer's CRS, EPSG:4269 (lat, long). If you check the CRS of ellipses_out, you will see its CRS is EPSG:4269.
For a solution, use ...
You can create a pseudo-random value that remains constant, based on the inherent properties of each feature with some mathematical operations. Inherent properties can be the x-/y-coordinate values (as proposed already) or $id of each feature. As you mentioned, $x and $y values are too close to each other to work as a kind of "random" ...
I have two solutions that could work :
if your cell height don't vary too much.
if your label need to appear only in one atlaspage, or in all atlaspage but not on two atlaspages.
You still use the table but make multiple "cadre" (sorry I don't know the English name, it is just above position and size). This is normally used when you have a table ...
You can use filter in the aggregate expression IF your symbol_label is a value that can be obtained from your attribute.There is an easy way to do this, but it iss in PR limbo.
Such as sum($area,filter:="attribute"=@symbol_label)
Also be caution if you want to multiply this value and concat the string. The concat operator has precedence over math ...
You can use this QGIS expression: replace the number 1 at the second last line with any number from 1 to 26 to get the corresponding letter - if you set it to 5, it will return E: