source: issm/branches/trunk-larour-NatGeoScience2016/src/m/exp/exp2shp.m@ 21243

Last change on this file since 21243 was 18213, checked in by schlegel, 11 years ago

CHG: add geometry settings

File size: 830 bytes
Line 
1function exp2shp(shapefilename,expfilename,geometry)
2%SHPWRITE - write a shape file from a contour structure
3%
4% Usage:
5% exp2shp(shapefilename,expfilename,geometry)
6%
7% Example:
8% exp2shp('domainoutline.shp','domainoutline.exp')
9% exp2shp('domainoutline.shp','domainoutline.exp','Polygon')
10% exp2shp('massfluxgate.shp','massfluxgate.exp','Line')
11%
12% See also SHPREAD, SHPWRITE, SHP2EXP
13
14shp=expread(expfilename);
15
16%initialize number of profile
17count=0;
18
19contours=struct([]);
20for i=1:length(shp),
21 if nargin < 3
22 if length(shp(1).x) == 1
23 geometry = 'Point';
24 elseif length(shp(1).x) < 3
25 geometry = 'Line';
26 else
27 geometry = 'Polygon';
28 end
29 end
30 contours(i).Geometry=geometry;
31 contours(i).id=i;
32 contours(i).X=shp(i).x;
33 contours(i).Y=shp(i).y;
34end
35
36shapewrite(contours,shapefilename);
37end
Note: See TracBrowser for help on using the repository browser.