Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 99589

For processes that involve enumeration or listing the finite number of iterations in an object, layer, feature, or other measurable instance.

2 votes

Counting points in polygons by weight and class in QGIS

Groups" AS "point_gr", SUM(p.Data) AS "value", COUNT(p.id) AS "points_count" FROM "cells" AS c JOIN "points" AS p ON st_intersects(c.geometry, p.geometry) GROUP BY c.id, p." …
Taras's user avatar
  • 34k
1 vote
Accepted

Counting points in polygons by weight and class in QGIS

Another solution using only native QGIS 3 tools. Let's assume there two layers "cells" and "points" with its corresponding attribute tables, see image below. Step 1. Use a 'Join attributes by locatio …
Taras's user avatar
  • 34k
1 vote

Getting number of features in the Attribute table using PyQGIS

Another option can be the allFeatureIds() method from the QgsFeatureSource class: num_of_features = len(layer.allFeatureIds())
Taras's user avatar
  • 34k
3 votes

Counting points within certain distance of each other in QGIS

Try also the "DBSCAN clustering" geoalgorithm. It contains a setting called 'Maximum distance between clustered points' and will provide in the end the "CLUSTER_SIZE" attribute.
Taras's user avatar
  • 34k
6 votes

Counting points in polygon to analyze data using QGIS

.*, COUNT(*) AS "numpois" FROM "polygons" AS poly JOIN "points" AS poi ON st_within(poi.geometry, poly.geometry) GROUP BY poly." … So, the new query will look like SELECT poly.*, COUNT(*) AS "numpois", GROUP_CONCAT(poi." …
Taras's user avatar
  • 34k
5 votes
Accepted

Counting features of point layer that are laying within polygon layer using QGIS

Use the "Count points in polygon" tool, which can be found under Vector > Analysis Tools > Count points in polygon as well as in the Processing Toolbox (Ctrl+Shift+T). …
Taras's user avatar
  • 34k
6 votes
Accepted

Showing feature count in layer name in QGIS

layer.featureCount() # setting up a new name layer.setName(f"{name} [{n}]") However, if this operation happens more often, one should think of a more programmatic way of showing the feature count … References: Rename layers with PyQGIS script Getting feature count of QgsVectorLayer using PyQGIS? Was QgsMapLayerRegistry being removed in QGIS 3? …
Taras's user avatar
  • 34k
1 vote

Creating new layer that shows the number of intersecting vector layers at each point in QGIS

Apply the "Count Polygon Overlap" model with a desired input layer and get the output like this References: QGIS Resource Sharing - Documentation …
Taras's user avatar
  • 34k
5 votes

Getting the number of features in shapefile without opening it using Python

os.path import normpath from shapefile import Reader absolute_path_to_shp = normpath("C:/Users/taras/files/cluster_test.shp") shp = Reader(absolute_path_to_shp) print(shp.numRecords) # returns features count
Taras's user avatar
  • 34k
7 votes

Counting fire occurences per county per year using QGIS

SELECT "COUNTY_NM" || ' | ' || GROUP_CONCAT("layer" || ' : ' || n) AS res FROM ( SELECT "COUNTY_NM", "layer", COUNT("layer") AS n FROM "points" GROUP BY "layer", "COUNTY_NM") GROUP BY "COUNTY_NM …
Taras's user avatar
  • 34k
5 votes

Determining number of vertices of selected object in QGIS 3

Try using the "Identify Features" tool (Ctrl+Shift+I) from the Attributes Toolbar. Click on the target feature and check the (Derived) tab, where you may see the 'Vertices' attribute
Taras's user avatar
  • 34k
1 vote

Creating field from number of items separated by "|" in field in QGIS

As an alternative you may try the following expression: array_length(string_to_array("ID", delimiter:='|'))
Taras's user avatar
  • 34k
5 votes

Counting number of selected features in QGIS

Also can be achieved with this expression count(1, group_by:=is_selected()), based on the is_selected() function. Returns True if a feature is selected. … The total number of selected features will be represented in the row called 'Count'. References: DefKey | QGIS 3.10 keyboard shortcuts …
Taras's user avatar
  • 34k
1 vote

Counting stacked polygons in PostGIS

Extending the idea from @geozelot it is possible to count the polygons via grouping by their geometry. … With the following expression: SELECT GROUP_CONCAT("id") AS ids, GROUP_CONCAT("uniqueID") AS uniques, COUNT(*) AS NumGeom, -- COUNT(*) geometry AS geom FROM "poly_test" GROUP BY …
Taras's user avatar
  • 34k
3 votes
Accepted

Counting points in hex grid by attribute in QGIS

With the following query, it is possible to count points within a polygon layer, grouped by an attribute of the points. … (poi.geometry, poly.geometry) AND poi.attribute = 'A' GROUP BY poly.id ) ON poly.id = idA LEFT JOIN ( SELECT poly.id AS idB, count(1) AS countB FROM "Random points in polygons" AS …
Taras's user avatar
  • 34k