[GIS] How to do a Point to Polygon analysis with multiple variables in QGIS

bufferpointpolygonqgis

I have a database of almost 10k crimes, which are divided in to 10 categories and plotted on a map

I also have a database of 12k addresses, which are also plotted on the map.

I aim to perform a multiple regression to determine whether there are correlations between types of crime and house price.

I have created a buffer of 250 meters around each of the addresses, and would like to list a count of each of the crimes which are located within this buffered zone for each of the addresses, however, I can only get QGIS to give me a count of all types of crime, rather than the specifics.

Does anyone know how to do a point to polygon analysis of this type? I am in the middle of breaking the crime databases to analyse each one separately, which is a bit difficult!

Best Answer

Where your crime points have numeric fields which are amenable to simple statistics (mean, max, min, sum and median), this is straightforward. In QGIS go Vector->Data Management->Join Attributes by Location and set your target layer to the polygons and the 'join vector layer' to your points, then choose the summary statistics (second option). In ArcGIS, use Spatial Join and in the field mappings set the statistics options.

Text fields and numeric fields that represent classes or types of objects (i.e. where statistics would be meaningless) pose a bit more of a problem. If this is what you need to get, I would write a script using Python or ArcPy and have an iterative process that cycles through the polygons, selects points by the current polygon and then iterates over my selection to build a comma delimited text field. Alternatively, you could have a number of fields that are perhaps 'bins' to count crimes by type or something.

However, a better approach might be to write your script the other way round and cycle through the points, selecting polygons that contain them and append just the polygon IDs to a delimited text field. You then have a table of all the crimes which has a field listing all the nearby properties and you have preserved all the crime data without any summary. You can then analyse this in all sorts of ways to understand the associations of crimes and properties by selecting all crimes associated with a single property and perhaps creating a pivot table.

Related Question