Find the maximum value for a point among several overlapping vector layers in QGIS3
You could use Point Sampling Tool plugin.
Note) If you run Point Sampling Tool plugin on a polygon layer which has overlaps, the tool take the attribute value only from the top feature found at the location.
(1) Merge all polygon layers (which produces a polygon layer with a lot of overlapping polygons).
(2) Run Order by expression tool (Processing Toolbox > Vector general)
Select your noise
value field as the expression and tick Sort ascending
checkbox, so that the polygon with maximum noise comes on top.
(3) Use Point sampling tool to take the noise value from the newly created Ordered
layer.
(4) Open the attribute table of the output from the Point sampling tool.
(... my second sampling point missed all polygons, unfortunately).
Since you tagged pyqgis, here is a python solution which you can run from the python console. A couple of notes on the script. Since you say have around 80 polygon layers, the script below takes all polygon layers in the current project and stores them in a list, so when you run this script you should make sure your project does not contain any polygon layers which are not part of this 'noise measurement' dataset. Otherwise, if you are handy with python, feel free to devise any other way to access the relevant polygon layers and store them in a list.
You will also need to change the name of the point layer in the code to match yours, as well as the name of the field in your polygon layers which contains the noise measurement data (I hope the field name is the same in every polygon layer, otherwise we're stuffed!). I have commented the code where to change the names.
A new column will be created in the point layer called 'Max_noise' containing the maximum noise reading from all the overlapping polygons. If no polygon geometry intersects the point, the field should be NULL for that feature.
I tested it on a small number of layers with test data and it should do what you want. Hopefully it will not be too slow on your data sets- several hundred points x 80 layers x ?? number of polygons in each layer is quite a few iterations so it might take a while to run.
_project = QgsProject().instance()
pnt_lyr = _project.mapLayersByName('Noise_points')[0] #Change point layer name to match yours
pnt_lyr.dataProvider().addAttributes([QgsField('Max_noise', QVariant.Int)])
pnt_lyr.updateFields()
poly_lyrs = [l for l in QgsProject().instance().mapLayers().values() if isinstance(l, QgsVectorLayer) and l.geometryType() == 2]
polys = []
for l in poly_lyrs:
polys.append([f for f in l.getFeatures()])
max_fld = pnt_lyr.dataProvider().fields().lookupField('Max_noise')
point_fts = [f for f in pnt_lyr.getFeatures()]
pt_index = QgsSpatialIndex()
for ft in point_fts:
pt_index.insertFeature(ft)
for f in point_fts:
id = f.id()
pt_geom = f.geometry()
noise_vals = []
for l in polys:
for f in l:
if pt_index.intersects(f.geometry().boundingBox()):
if f.geometry().intersects(pt_geom):
noise_vals.append(f.attribute('Noise_level')) #change field name to match yours
if noise_vals:
atts = {max_fld: max(noise_vals)}
pnt_lyr.dataProvider().changeAttributeValues({id: atts})
Result after running the code. The canvas shows sample points labelled in red with their feature ids, and overlapping polygons labelled with 'Noise_level'. In the point layer's attribute table you can see that the 'Max_noise' field has been created and filled with the maximum value of all overlapping polygons which intersect each point: