Changeset 19422


Ignore:
Timestamp:
07/03/15 00:43:23 (10 years ago)
Author:
cborstad
Message:

CHG:Python: fixing shp2exp to handle polygon layers and shapefiles with multiple contours

File:
1 edited

Legend:

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

    r17612 r19422  
    3333                geom=shp.shapes()[i].shapeType
    3434                if geom==5: # polygon
    35                         x=[p[0] for p in shp.shapes()[i].points]
    36                         y=[q[1] for q in shp.shapes()[i].points]
    37                         expdict['x']=x
    38                         expdict['y']=y
    39                         expdict['nods']=len(x)
     35                        tmpx=[p[0] for p in shp.shapes()[i].points]
     36                        tmpy=[q[1] for q in shp.shapes()[i].points]
     37                        #x.extend(tmpx)
     38                        #y.extend(tmpy)
     39                        x.append(tmpx)
     40                        y.append(tmpy)
    4041                elif geom==3: # line
    4142                        x=[p[0] for p in shp.shapes()[i].points]
     
    4344                        x.append(x[0])
    4445                        y.append(y[0])
    45                         expdict['x']=x
    46                         expdict['y']=y
    47                         expdict['nods']=len(x)
    4846                elif geom==1: # point
    4947                        x.append(shp.shapes()[i].points[0][0])
    5048                        y.append(shp.shapes()[i].points[0][1])
    51                         expdict['x']=x
    52                         expdict['y']=y
    53                         expdict['nods']=len(x)
    5449
    55         expwrite([expdict],expfile)
     50        expdict['x']=x
     51        expdict['y']=y
     52        expwrite(expdict,expfile)
Note: See TracChangeset for help on using the changeset viewer.