필터 지우기
필터 지우기

Statistic summary of values of raster pixels inside polygons?

조회 수: 10 (최근 30일)
Marmar
Marmar 2018년 5월 8일
답변: Reema Alhassan 2018년 6월 10일
Hi there, I have a raster satellite image that I imported to matlab as geotiff and I have a file (shapefile) with several polygons (about 500), form the same area, that I imported in matlab by shaperead function. I want to know the mean, maximum, minimum and sum of the values of the pixels of the raster that are within each polygon. So I finally want to have a matrix with 500 rows, which each row represents a polygon and 4 columns that each indicates a parameter (mean, maximum, minimum and sum). Any idea is really appreciated. ?!

채택된 답변

KSSV
KSSV 2018년 5월 9일
As you said you have polygons in hand.......you can extract the points of the raster lying inside these polygons using inpolygon. inpolygon gives you indices of the raster points lying inside the given polygon. Once indices are known, you extract the points and calculate mean, max, min and sum. Bottomline read about inpolygon.
  댓글 수: 1
Marmar
Marmar 2018년 5월 9일
Hi Thanks, do you have any idea how can I put a raster in inpolygon function? SO I had a raster and a polygone and now I imported them to Matlab by shaperead and geotiffread. SO I thinkn in inpolygon function it just needs coordinates! Thanks for your reply in advance

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Reema Alhassan
Reema Alhassan 2018년 6월 10일
Hello Marmar,
this is exactly what I need to do if you have a code of doing this could you share it please ? till know I can do statistics for only a shape with one polygon but I need to do the same with a file with many polygons and I couldn't if you know a way of doing this please let me know
Many thanks.

카테고리

Help CenterFile Exchange에서 Elementary Polygons에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by