Skip to content

Instantly share code, notes, and snippets.

View dimasmaulana99's full-sized avatar
🏠
Working from home

Dimas Maulana Ichsan dimasmaulana99

🏠
Working from home
View GitHub Profile
@timlinux
timlinux / find_multipart.py
Last active August 13, 2023 13:19
A QGIS Python snippet to select multipart features in the active layer
# Find all multipart features in the active layer
l = iface.activeLayer()
iter = l.getFeatures()
geoms = []
for feature in iter:
geom = feature.geometry()
if geom.isMultipart():
l.select(feature.id())
geoms.append(geom)
@dimasmaulana99
dimasmaulana99 / find_multipart.py
Created August 13, 2023 13:19 — forked from timlinux/find_multipart.py
A QGIS Python snippet to select multipart features in the active layer
# Find all multipart features in the active layer
layer = iface.activeLayer()
# Clear the selection first
layer.removeSelection()
# Iterate through features and select the multipart ones
for feature in layer.getFeatures():
geom = feature.geometry()
if geom.isMultipart():