Why I get this error "Coordinates in 'Point' geographic data structure S must be scalar" when I use shapewrite?
    2 ビュー (過去 30 日間)
  
       古いコメントを表示
    
I want to write a shapefile using shapewrite function and I get the following error "Coordinates in 'Point' geographic data structure S must be scalar." My data are the followings: Data =
    Geometry: 'Point'
         Lat: [40.6214 40.5959 40.6159 40.5873 40.6081]
         Lon: [22.9739 22.9533 22.9527 22.9424 22.9766]
What is the problem?
0 件のコメント
採用された回答
  KSSV
      
      
 2016 年 9 月 28 日
        
      編集済み: KSSV
      
      
 2016 年 9 月 28 日
  
      clear;clc
Lon = [22.9739 22.9533 22.9527 22.9424 22.9766]  ;
Lat = [40.6214 40.5959 40.6159 40.5873 40.6081] ;
Data = struct([]) ;  % initilaize structure 
for i = 1:length(Lon)
    Data(i).Geometry = 'Point' ; 
    Data(i).Lat=Lat(i)  ;  % latitude 
    Data(i).Lon =Lon(i) ;  % longitude 
    Data(i).Name = randseq(1) ;   % some random attribute/ name 
end
shapewrite(Data, 'myfile.shp')
p = mappoint(shaperead('myfile.shp'))
その他の回答 (0 件)
参考
カテゴリ
				Help Center および File Exchange で Geographic Plots についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

