TransWikia.com

Selection/Extraction of features based on location AND attribute

Geographic Information Systems Asked on January 16, 2021

My data consists of a point layer (iceberg positions containing their acquisition date as attributes) and a polygon layer (areal extends of DEMs also containing the acquisition date).

My aim is to select/extract the features based on their same location (the iceberg positions overlapping with the DEM extends) AND under the condition that they possess the same acquisition date.

Unfortunately I couldn’t figure out how I can solve this problem.
What I tried is:

  1. Extracting by location, which only fulfills the condition that their locations overlap
  2. To figure out how to run an extraction/selection based on the attributes of different layers, which I haven’t figured out yet

Both the layers of the iceberg positions and DEM extends extracted by their (intersecting/overlapping) location. I try to figure out how to extract/select those, who intersect AND have the same acquisition date

2 Answers

You can use a virtual layer to join the layers. You can then save as the output if you want to persist the data.

Go to the menu Layer > Add Layer > Add/Edit Virtual Layer... and enter the following query. Replace the layer name for yours

select pt.*, poly.ID
from mypointlayer pt
join mypolygonlayer poly
 on st_intersects(pt.geometry, poly.geometry)
    AND pt.acquisition_date = poly.acquisition_date

Answered by JGH on January 16, 2021

You can achieve your request using the tool Select feature by expression available in the selection Toolbar. enter image description here

Here, having the point layer active in the TOC, you can use this expression

contains(
aggregate(
layer:='polygon',
aggregate:='collect',
expression:=$geometry,
filter:="date" = '2020-09-06'
)
,$geometry)

This will select all the points that are inside the polygons that respect the filter rule: in this case only the polygons that have a specific data as attribute.

enter image description here

Having all the requested point selected you can now create a new layer exporting only the selected features.

Answered by Val P on January 16, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP