Creating a georeferenced polygon
4 views (last 30 days)
Show older comments
Hi all,
I'm trying to map out a certain area over southern Africa, which is meant to look like the one in the image. The image was created with the matrix dro_dom_fill containing 1's for the regions of interest and NaN's otherwise. From this matrix, I am trying to create a georeferenced polygon or something similiar, so that I can find gridpoints in another dataset with a different resolution that lie within the domain. However, if I run this code my polygon looks like in droughtdomain_geoshape.jpg attached
[LAT,LON]=meshgrid(lat,lon);
a=dro_dom_fill.*LAT
b=dro_dom_fill.*LON
a(isnan(a))=[]
b(isnan(b))=[]
g=geoshape(a,b,'Geometry','polygon')
worldmap([-35 0],[9 50]), bordersm
geoshow(g)
0 Comments
Answers (2)
Bruno Luong
on 13 Nov 2018
Edited: Bruno Luong
on 13 Nov 2018
You can get a linear connected contour (polygon) by
C = contourc(lat,lon,double(isfinite(dro_dom_fill)),0.5*[1 1]);
C = C(:,2:C(2,1)+1) % Assuming it returns 1 polygon
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!