I am using the plugin zonal statistics to calculate the sum of the raster cells within  polygons. How does this plugin handle pixels that are on the border of the polygon, are those cell values included in the statistics?  I am using QGIS 1.8.0.
10853
There are a couple Stackexchange posts asking this question, but neither of them were sufficiently answered:       I am writing Python scripts that perform essentially the same operations as Zonal Stats, and I have been using Zonal Stats to check my scripts' outputs.   I have noticed that when there are many cells in the polygon being queried, my results match perfectly, but there are discrepancies when there are only a few raster cells in the polygon. The following is an example of this. I am computing "count" for each polygon.  Exhibit 1:   The returned count is 0.45, which looks roughly correct if pixels can be treated fractionally rather than simply in/out.  Exhibit 2:   Similar result; count is 0.39.  Exhibit 3:    With a larger poylgon, now we see the count is exactly 2. Note that there are exactly 2 pixel centers contained in the polygon.  Exhibit 4:    Here, only one pixel center is within the polygon. The count is 1.008, though. If you exclude the polygon area from the pixel whose center is in the polygon, the remaining area is obviously greater than 0.008 of a pixel.   From these exhibits, it seems that Zonal Statistics treats these cases specially. It looks like to me that if there are less than 2 pixel centers within the polygon, it performs some kind of averaging such as polygon_area/raster_cell_area to return the count. I should note that I have 48 of these polygons, and all returned counts greater than or equal to 2 are integers; fractional counts are only returned for &lt;2.  How are these fractional-pixel counts incorporated into the other statistics output by Zonal Stats?    indicates strange behavior with max/min when using large raster cells, and my own testing returns mean values not congruous with simple "pixel center in/out of the polygon." To reiterate, I get exact agreement when the underlying raster contains many pixels within the polygon. I couldn't find any documentation about this, and it may be important when people have never had problems with Zonal Stats but use a coarse raster and remain unaware that there is a different behavior when there are only a few pixels within the polygon.
80381
Could anyone provide with a way to calculate latitude and longitude from DEM, for each raster cell?   In previous posts about this, I have seen that some suggest calculating lat and long in certain sample point locations. This doesn't work for me, as I need complete rasters.   Also, I use ArcGIS 10.2 version so $$XMAP, $$YMAP does not work for me.   Is there any other way inside ArcGIS to get lat and long?
71658
I have a large raster layer with wind speed values assigned to each cell. I also have point data that displays locations where wind farms have been constructed. I would like to add the raster values to the wind farm location data. The goal is to figure out when each wind farm was built over each wind speed value. Any ideas?
44587
Is it possible to calculate the sum of polygon areas based on whether or not it has a value in another column?   For example:  In column 2 I have the area of polygons. I want to calculate the area of all polygons that contain 'AG' in column 1 or all polygons that are IN column 1. But calculate them separately so I can get the total area of each type in column 1.
47705
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!
4943
I would like to calculate the sum of values in one column, based on values in another column. To illustrate my question I uploaded the picture below. The second column consists of zipcodes, the third total sales. I would like to know what the total sales per zipcode are? So in this case:  What is the sum of column three for column two's value 1023? Output then should be 4 (0+1+1+2+0). The sum for 1024 then should be 11,5 following the same logic.  As this is quite a large dataset I would like to have the QGIS field calculator (or any other tool) calculate a new field which states the total sales in the zipcode. So far I can't seem to get it working and was hoping someone here could help me.  As you can see I have some missing values, is this a problem in calculation? Perhaps good to mention is that it is a table.
80896
How does one go about obtaining a summary of the counts of cell values within a raster in QGIS? I know QGIS is doing this, in order to provide the summary statistics and histogram in the properties of the layer. I do not need the summary statistics nor a histogram image, but rather counts of individual values.   It looks like there was at one point an attempt to add a special feature for this (Feature #4321, ).   Am I missing something really obvious?
71694
I have a set of points (meteorological stations) with 5km buffers around them. Additionally, I have a set of polygons (municipalities) in which those stations are located.  I would like to have data on how much of the buffer is filled by each polygon but I was not able to find a function or a way to do it. So for example for point A I would have that in the buffer of 5km there is 80% of polygon B and 20% of polygon C as the output.  Edit:  The anwsers provided do anwser this question in a setting in which I know what polygons and buffers I need to have in the code or when I can do it manualy. Problem is that in my setting with 1 shapefile having 500 polygons and one vector layer having 13000 buffers I am unable to do this manually and I am asking if there is an easier way to do it. I tried implementing the approaches in the questions but I was unable to use them on my example in big scale. Moreover I had problems with coding that I also noted in comments down below.   Main difference to the other similar question provided is that I have 2 vector layers (Buffer with 500 buffers and Municipalities a shape file with 500 different polygons). Previous questions were analyzing this question in situations in which I know precisely the polygons and buffers analyzed, at least that is how I understood them, so after trying to use those approaches on my datasets I was not able to replicate them.  Another way of approaching this problem for me is to use join attributes by location -one-to-many and then getting averages of the duplicate results, only problem is that then I take average of polygons instead of their weights corresponding to % of intersection with the buffer. In my case I do not know what polygons of the shapefile are going to intersect what buffers, or even if the buffer is going to be intersected by 1,2 or more polygons
44057
Here is what I'd like to achieve in QGIS.   Is there a processing tool to remove the overlapping part of polygons?    It is also very important that they do not get merged during the process and that they keep their original attributes since I need to work with them afterwards.
93082
Plugin Raster->TerrainAnalysis->slope which had initially worked, started showing what another questioner referred to as a "crazy histogram":   Before finding his question and the answer, I endeavored to uninstall and reinstall the plugin.  I found/still find (QGIS 2.0.1, now upgraded to QGIS 2.4, on Ubuntu 14.04), the plugin "uninstall" button grayed out/disabled.  It's working, but I am worried about having a plugin I installed that does not offer an option to be uninstalled.  Failing anything else I would be tempted to use the path information to rename the .so library and see if it disappeared.
41217
I have a raster image (Sentinel-2 band 4) and a shapefile covering the same area than the image (same projection and extension). The shapefile has different polygons which are agricultural fields.   I want to create a new file where, for each polygon, the mean value of the pixels that are inside it is calculated.  Could you please help me to find an appropriate R code for that?
39818
I've got a polygon feature class with Z values enabled. The polygon entities represent billboards. I'm looking for a way to measure the front surface area of this entities - i.e the area of the billboards from one side.  Can I do this using a Geoprocessing tool?  Some snapshots    Polygon in ArcMap    Polygon in ArcScene
28539
In QGIS, is there a way to count the number of vertices of polygons and lines in a given layer, and create a separate field containing these values?   I suspect it's a function somewhere in the field calculator but I can't find it.
98310
I would like to count the amount of points that are out of the polygon because I need to sum them.  I know how to count how many points are inside but in need to find how many there are outside.
32832
I have a raster and a vector point file. I need to generate another raster of same resolution showing how many points are inside the corresponding pixels of the original raster.  Something like that:   Is there a way of doing that in QGIS?   I just want the number of points, no attributes involved.
12918
I have a vector layer of habitats. Each feature belongs to a category and has its area calculated. I'm trying to find out the total area of each type of habitat.  I've looked at QGIS "Statistics by categories" which gives everything but the Sum of each category.  The GroupStats plugin looks like it would do it, but I can't get the "calculate" button to activate.  I'm new to QGIS tools/scripts etc but happy to try to modify an existing tool but haven't yet found where they are or how to do this.
43437
I have two shapefiles....   points containing a number field 'response_time' a polygon grid of square polygons containing fields including 'PNTCNT' with the number of points per polygon, calculated already using the tool 'points in polygon'   There are between 0 and 600 points within the bounds of each polygon in the grid.  I want to add fields to the polygon grid for the mean, min and max response times within each polygon, in addition to the PNTCNT field already there.  I have tried the 'Join attributes by location' tool, making the polygon layer the target and the points the join layer, and vice versa. I've selected 'take summary of interesting features'.  But I can't get the result I want. All I end up with is the polygon grid again but with an extra field 'COUNT' which replicates (or duplicates) the 'PNTCNT' field. No min, max and mean of values from the points layer.  What am I doing wrong? Is there a better way to do this? I have tried this using QGIS 1.7 and 1.8.