How to ignore points outside polygon shapefiles MATLAB mapping toolbox

Hello:
I have polygon shape file, where the shape file comprises of multiple polygon each in a struct format. I want to superimpose gridded data over it, however, I want to mask the data points which are not located within these polygons. I came across several example, for example, one here: https://de.mathworks.com/matlabcentral/answers/311766-how-to-mask-data-points-outside-a-border-using-geoshow
Since ours is not a standard shapefile as available within MATLAB but an area of watershed comprising several polygons, the code shown here is not working for me. Could any one pls. suggest how to remove the data points from visualization which is not located within the polygon.

답변 (1개)

KSSV
KSSV 2021년 6월 4일

0 개 추천

REad about inpolygon, this will give you indices of points lying inside the polygon.

댓글 수: 3

I know about inpolygon. I also know declaring Nan for outside points discard the data. The problem is here the polygon boundaries are in struct format, also in the process of regridding the resolution of polygon shape boundary versus the gridded data resolution do not matches, so it detects everything outside boundary.
Attach your data.
I have attached my shapefile along with an excel sheet that contain longitude, latitude and the value. I needed to map thes values over the shapefile.

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

카테고리

태그

질문:

2021년 6월 3일

댓글:

2021년 6월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by