Update: I’ve revisited this comparison for QGIS 3 in Revisiting point & polygon joins
Joining polygon attributes to points is a pretty common geoprocessing step. There are multiple ways to solve the problem in QGIS, so I thought I’d have a look at how they perform. There is Join attributes by location in the Vector menu and Add polygon attributes to points in the Processing toolbox.
My test data: Two shapefiles with 18,713 points and 17,397 irregular polygons.
(Some system specs: 1.3GHz dualcore with 4GB RAM)
And here are the results:
|SAGA Add polygon attributes to points:||44 seconds|
|Vector | Data management tools | Join attributes by location:||killed after 16 hours|
This point clearly goes to Processing and the SAGA algorithm it provides access to. Join attributes by location offers some nice options for aggregating data but it just can’t cope with the number of features in this test.
To measure execution time (in a very unscientific way), I just ran the tool from the python console using:
import datetime import processing print datetime.datetime.now() processing.runalg("saga:addpolygonattributestopoints","C:/Users/Anita/poi_wien.shp","C:/Users/Anita/REALNUT2009OGD.shp","NUTZUNG_CO",None) print datetime.datetime.now()
Some notes of caution:
SAGA comes readily installed in OSGeo4W. As far as I know, the stand-alone installer for Windows currently does not include SAGA but it can be installed manually. On Ubuntu, the standard repos only contain SAGA 2.0.8 but 2.1 is required.