Changeset 17026


Ignore:
Timestamp:
12/17/13 14:46:22 (11 years ago)
Author:
cborstad
Message:

CHG: added support for line shapefiles

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/shp/Shp2Exp.m

    r16852 r17026  
    1515        shp=shaperead(shapefilename);
    1616
    17         exp=struct([]);
     17        expstruct=struct([]);
    1818        for i=1:length(shp),
    1919                if strcmpi(shp(i).Geometry,'Polygon'),
     
    2121                        ids=find(isnan(x));
    2222                        x(ids)=[]; y(ids)=[];
    23 
    24                         exp(end+1).x=x;
    25                         exp(end).y=y;
    26                         exp(end).nods=length(x);
    27                         exp(end).density=1;
    28                         exp(end).closed=1;
    29                         exp(end).name=num2str(shp(i).id);
     23                        expstruct(end+1).x=x;
     24                        expstruct(end).y=y;
     25                        expstruct(end).nods=length(x);
     26                        expstruct(end).density=1;
     27                        expstruct(end).closed=1;
     28                        expstruct(end).name=num2str(shp(i).id);
    3029                elseif strcmpi(shp(i).Geometry,'Point'),
    31                                 x=shp(i).X; y=shp(i).Y;
    32 
    33                                 exp(end+1).x=x;
    34                                 exp(end).y=y;
    35                                 exp(end).nods=length(x);
    36                                 exp(end).density=1;
    37                                 exp(end).closed=1;
    38                                 %exp(end).name=num2str(shp(i).id);
     30                        x=shp(i).X; y=shp(i).Y;
     31                        expstruct(end+1).x=x;
     32                        expstruct(end).y=y;
     33                        expstruct(end).nods=length(x);
     34                        expstruct(end).density=1;
     35                        expstruct(end).closed=1;
     36                        %exp(end).name=num2str(shp(i).id);
     37                elseif strcmpi(shp(i).Geometry,'Line'),
     38                        x=shp(i).X; y=shp(i).Y;
     39                        expstruct(end+1).x=x;
     40                        expstruct(end).y=y;
     41                        expstruct.x(end)=x(1);
     42                        expstruct.y(end)=y(1);
     43                        expstruct(end).nods=length(x);
     44                        expstruct(end).density=1;
     45                        expstruct(end).closed=1;
    3946                end
    4047        end
    4148
    42         expwrite(exp,expfilename);
     49        expwrite(expstruct,expfilename);
Note: See TracChangeset for help on using the changeset viewer.