1

I would like to extract statistics from a raster file based on a land cover classification vector file, however the land covers (features) are not contiguous (see pic).

In the example below, I would like to calculate a 90th percentile of all pixels in the "12" feature of the overlying vector file. I am looking for a single value, not a 90th percentile for each of the polygons of feature "12".

I can't figure how to do this and get one statistic value for each feature type. Is this even possible in QGIS? If not, is there another way to accomplish this?

enter image description here

0

Yes, we can use SAGA - Raster Statistics for Polygons tool. It is accessible from QGIS Processing Toolbox | SAGA | Vector <-> raster. And a key message is "Use multipart polygon".

Overview of the workflow is like a picture below: enter image description here

Each step is:

1) Create Multipart polygon

  1. Open the attribute table of your feature "12" and create a new field group and give a same number (such as 1) to all polygons.
  2. Activate Singleparts to multipart tool (from menu; Vector | Geometry tool)
  3. (1) Input layer is your feature "12"
  4. (2) Select the group field you have just created. All polygons which has same group number are put together.

2) Calculate statistics (Q90)

  1. Activate Raster statistics for polygons tool.
  2. (3) Select your raster layer in Grids
  3. (4) Select Multipart layer from above step.
  4. (5) Ignore all statistics you do not need.
  5. (6) Enter 10 in the Quantiles (Do not enter 90). This 10 is the quantile interval, so you will obtain Q10, Q20, ..., Q90. .
  6. Run this tool.
  • Thankyou. I am using QGIS 2.18 and do not have the Raster statistics for Polygons tool. – Amie Last Name Jun 25 '18 at 2:22
  • @AmieLastName I am also using QGIS 2.18. It is in the Processing Toolbox. – Kazuhito Jun 25 '18 at 2:23
  • Am I able to add screen shots in here? It is not in my Processing Toolbox and it does not come up when I search. Am I perhaps missing a plug-in? – Amie Last Name Jun 25 '18 at 2:25
  • Thankyou for your answer. As stated, I did not have 'The raster statistics for polygons' tool visible in my QGIS install. After troubleshooting and researching similar issues online, a suggestion was to remove and reinstall my QGIS installation. This I did and lo and behold, I could see additional Processing Tools, including the one mentioned above. Your solution and instructions given above answered my question perfectly once I could use the tool. – Amie Last Name Jun 25 '18 at 6:21
  • Great, thanks @AmieLastName Sorry I did not know the cause, but glad to know you had managed it. – Kazuhito Jun 25 '18 at 9:06

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.