How to generate an image from a shapefile with the same projection of a GeoTIFF?
13 views (last 30 days)
Show older comments
Emanuele Ferrentino
on 29 May 2020
Edited: Emanuele Ferrentino
on 1 Jun 2020
Hi,
I'm looking for a way to generate an image with the same projection of a GeoTIFF that it is independent of the shapefile (they only share the same world area).
I found a code that can generate a binary mask with the same GeoTIFF projection:
R = geotiffinfo('r_cd_geocod.tif']);
[x,y] = pixcenters(R);
[X,Y] = meshgrid(x,y);
roi = shaperead('GUF_shape_subset_fixed_repaired_wDAMAGE.shp']);
for i = 1:length(roi)
rx = roi(i).X;
ry = roi(i).Y;
mask_temp = inpolygon(X,Y,rx,ry);
mask = mask | mask_temp;
end
obtaining that:

However, I would like to associate on every polygon the corresponding damage_idx attribute:

in order to obtain something like that:

I hope that someone can solve my problem. Thank you very much for the help.
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Map Display in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!