Adding attributes to datapoints from overlapping polygons in qgis
Asked Answered
T

2

5

I have an interesting problem in QGIS, I have a vector layer of points (shown in purple) and a layer of polygons (green) with a number of metadata attributes attached (i.e. date, id number etc).

I want to attach the data from the polygon to the point data underneath them. The problem is I have some overlap where point data is covered by two polygons.

In these instances I essentially want to duplicate the point data so in the attributes table for the layer I have a point for each polygon which overlaps, with corresponding meta-data. This means I can't simply use the "Join attributes by location" tool as it will only assign data from the closest polygon, or a sum/mean etc of the two overlaps.

An illustration of the data is below. Any suggestions on how to solve this problem would be most appreciated.

enter image description here

Tense answered 4/9, 2015 at 9:12 Comment(0)
T
5

After a bit of faffing I've found a solution that works quite well.

  • Firstly open the "Clip points with polygons" tool in the "processing" plugin.
  • In the menu select your points layer and your polygon layer.
  • Select the green circle arrow in your polygon layer to set it to iterate over each polygon.
  • Select the attribute you want to add to the points layer.
  • Select "seperate layer for each polygon".
  • Name the output folder (best to create an individual new folder to help with merging later) and hit OK.
  • Next go to Vector->Data management tools->Merge Shapefiles to One
  • Select shapefile type "point"
  • Select input directory as the directory where you created all your earlier points files
  • Hit run

You should now end up with a layer containing points with data from more than one polygon where they overlap. The only problem I have is you can only add one piece of data from the polygon with the clip tool, this is fine for me at the moment but could be an issue.

If anybody knows of a different/better way or a way of adding more than one bit of data from the polygon please add it.

Tense answered 4/9, 2015 at 14:32 Comment(1)
Note: to get over the problem of only a single data column able to be added at a time, one could make this column a unique ID for each polygon, attach this to all the points and then join a database based on this ID.Tense
H
4

I believe this can also be done using the intersect geoprocessing tool (Vector- Geoprocessing Tools - intersect). At least for me it works when I have a point layer with points in overlapping buffers of a polygon layer. When I intersect I then have one, two or more records per point in the attribute table, depending on how many polygons overlap.

This way you also get all the attributes from the other layer.

Heap answered 26/4, 2016 at 7:49 Comment(1)
this works really wellKantianism

© 2022 - 2024 — McMap. All rights reserved.