How can I create a point shapefile from a csv (or matrix) with lat/long columns?
3 ビュー (過去 30 日間)
古いコメントを表示
I have a csv file (or I can use a matrix object) within Matlab that I need to convert to a shapefile (points). An example of the first 3 rows of my data is below.
% X Y var1 var2 var3
%463310.925537576 5013978.52568211 5 8 1
%464344.150891795 5013195.54547050 2 4 9
%463782.424931854 5012644.08397560 2 1 8
I want to create the point shp with this data. I've tried this:
%lat long needs to be plotted.
[T.Geometry] = 'Point';
T.x = 'X'; % latitude
T.y = 'Y'; % longitude
T.var1 = 'var1';
T.var2 = 'var2';
T.var3 = 'var3';
T
I've tried this:
%lat long needs to be plotted.
[T(1:1780).Geometry] = deal('Point');
T.x = 'X'; % latitude
T.y = 'Y'; % longitude
T.var1 = 'var1';
T.var2 = 'var2';
T.var3 = 'var3';
T
The problem is that these two methods only work if you delinate each point one at a time. I have a csv with 1780 points...
0 件のコメント
回答 (1 件)
Stijn Haenen
2020 年 3 月 23 日
Im not sure what you want, but maybe this can help:
for i=1:1780
T.(sprintf('var%g',i))=sprintf('var%g',i);
end
This creates a structure with 1780 fields
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!