1

I've been fiddling around with heatmaps on QGIS for a few days, but came across a small obstacle on my way. I have a dataset comprised of point data, corresponding to objects inside a 1 sq meter grid. Each of those objects has several data associated, namely their weight (in grams). So, I have already created a simple heatmap based on the number of points and another one using the grams value of each point as the weight parameter of the heatmap. This resulted in two different heatmaps, both of them interesting to my analysis.

Nevertheless, I have a different dataset that comes from the same grid - this dataset corresponds to objects that I know came from a specific square on the grid, but to which I don't have a specific point location (as I said, I only know they came from a specific square, but I don't have XY coordinates for them inside that square). I have all the other data for these objects, namely their weight and I wanted to use them to create a new heatmap, where I would attempt to represent the distribution of objects through the grid, based upon their weight. I was thinking of creating a new attribute on my grid shapefile, where I would insert the total object weight (both the ones to which I have XY coordinates and the ones to which I don't have that information) for each square.

I've been looking at the heatmap plugin on QGIS, but it only allows me to use point shapefiles as the input layer... Is there a way of creating a heatmap using polygons as the input layer? Remember, the polygons do not overlap, so I cannot use the approaches sugested elsewhere, regarding overlapping polygons.

I have already created a "points per polygon" shapefile and I guess I could also create a "total weight por polygon" shapefile, but I'd rather have a heatmap, since it would give out a less "boxy" visualization.

  • Can you provide a definition for heatmap? – mdsumner May 12 '14 at 8:47
  • In this case I'm considering heatmap as a raster representing the dispersion of data on my study area. It's like the weather graphics for temperature (thus heatmap), but relating to a different set of data. – TTome May 12 '14 at 9:53
5

You might want to create centroids for your grid of polygons, then and attach the weight value of the data with no exact location (located in a grid cell) to the centroids. This can be accomplished by:

  1. Vector->Geometry Tools->Polygon centroids
  2. Vector->Database management->Join attributes by location

That should give you the weights (from each polygon in the grid) into a point layer of centroids. Now you can merge these points together with your actual point locations to create one point vector with weights, and do any further heat maps etc.

If you want to total the weight per polygon, that's an additional process. I do these kinds of things in a database. Import both the polygon grid and the points into Spatialite, for example then try these SQL commands in Spatialite-gui:

ALTER TABLE grid ADD COLUMN total_weights REAL;
UPDATE grid SET total_weights=(SELECT SUM(p.weight) FROM points AS p WHERE ST_Contains(grid.geometry, p.geometry));

(Of course, you'll have to adjust the column names and table names)

  • I've tried your approach, it worked fine, but the results were not very good for my assessment. I guess it's an issue of the data in itself, not of the method used. Thank you anyway! – TTome May 16 '14 at 17:28
0

For this purpose, you should try choropleth heat-map. You can do this easily.

Just go to style from properties of your layer and change the single symbol to graduated and then you can pick your weighted column and create your heat-map. You can try different methods like natural breaks for your classification method. Click apply and Done!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.