印度如何作物形状从全球shapefile文件吗
5视图(30天)
显示旧的评论
你好:
我有两个shapefile:全球土地利用地图和印度的shapefile行政边界shapefile。有可能夹/印度地区作物使用从全球shapefile shapefile印度吗?
印度的shapefile可以在这个链接:
http://otlet.sims.berkeley.edu/imls/world/IND/IND_ADM0.shp
我有附加全球形状文件(Zip)。
接受的答案
KSSV
2020年8月31日
shpFile1 =“c1976_2000.shp”;
shpFile2 =“IND_ADM1.SHP”;
S1 = shaperead (shpFile1);
S2 = shaperead (shpFile2);
P1 = [[S1 (:)。X]的[S1 (:)。Y]];
P2 = [[S2 (:)。X]的[S2 (:)。Y]];
N =长度(S2);
% %从gloabl得到点文件从印度给文件
%将NaN的从P1
idx = isnan (P1 (: 1));
P =细胞(N, 1);%要求矩阵
%得到点躺在shapefile2 shapefile1形状
为i = 1: N
我
P2i = [[S2 (i)。X]的[S2(我)。Y]];
idx = isnan (P2i (: 1));
P2i (idx:) = [];
idx = inpolygon (P1 (: 1), P1 (:, 2), P2i (: 1), P2i (:, 2));
P{我}= P1 (idx:);
结束
P = cell2mat (P);
情节(P2 (: 1), P2 (:, 2),“。b”)
持有在
情节(P (: 1), P (:, 2),“r”)