Creating a shapefile from a set of coordinates
조회 수: 45 (최근 30일)
이전 댓글 표시
Hi all,
I have a set of rectangular's coord (Xmin,Xmax,Ymin,Ymax) in UTM coord. Could you please tell me how to create a rectangular (or polygon) shapefile based on those coordinates? Thank you in advance.
댓글 수: 0
채택된 답변
KSSV
2018년 9월 18일
Xmin = 0. ; Xmax = 1. ;
Ymin = 0. ; Ymax = 1. ;
x = [0 1 1 0] ;
y = [0 0 1 1] ;
Data.Geometry = 'Polygon' ;
Data.X = x ; % latitude
Data.Y = y ; % longitude
Data.Name = 'Rectangle' ; % some random attribute/ name
shapewrite(Data, 'myfile.shp')
p = shaperead('myfile.shp')
댓글 수: 6
Brittany K
2020년 3월 23일
Hello, I am experiencing similar difficulty. Would either of you know how to plot lat/long points from a single csv file that contains a X , Y, and 3 other variables? Once plotted, I would like to save it as a shapfile with the output in UTM hopefully. -Brittany
Sim
2022년 7월 6일
편집: Sim
2022년 7월 6일
Hi @KSSV, do you know how to perform the same you have suggested, but starting from a graph like this one ?
s = [1 1 2 2 2 3 3 3];
t = [2 3 3 4 5 6 7 5];
x = [0 0 1 0 4 3 1];
y = [0 1 0 4 5 0 -1];
G = graph(s,t);
G.Nodes.X = x'; G.Nodes.Y = y';
plot(G,'XData',G.Nodes.X,'YData',G.Nodes.Y)
I understood that I can use my x- and y- coordinates, as you have showed
Data.X = x ; % latitude
Data.Y = y ; % longitude
but how to insert/import the edges into the shapefile?
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Mapping Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!