Commit aa45dccc authored by Kris Vanneste's avatar Kris Vanneste
Browse files

Improved to_shapely method of PolygonData.

git-svn-id: https://svn.seismo.oma.be/svn/seismo/mapping/layeredbasemap/trunk@7182 40b490c5-b4d9-47cb-8714-9bef99b524d5
parent 18e3049d
......@@ -48,13 +48,21 @@ class PolygonData(SingleData):
"""
"""
if self.z is None or set(self.z) == set([None]):
return shapely.geometry.Polygon(list(zip(self.lons, self.lats)),
[list(zip(self.interior_lons[i], self.interior_lats[i]))
for i in range(len(self.interior_lons))])
if self.interior_lons:
shp = shapely.geometry.Polygon(list(zip(self.lons, self.lats)),
[list(zip(self.interior_lons[i], self.interior_lats[i]))
for i in range(len(self.interior_lons))])
else:
shp = shapely.geometry.Polygon(list(zip(self.lons, self.lats)))
else:
return shapely.geometry.Polygon(list(zip(self.lons, self.lats, self.z)),
[list(zip(self.interior_lons[i], self.interior_lats[i], self.interior_z[i]))
for i in range(len(self.interior_lons))])
if self.interior_lons:
shp = shapely.geometry.Polygon(list(zip(self.lons, self.lats, self.z)),
[list(zip(self.interior_lons[i], self.interior_lats[i], self.interior_z[i]))
for i in range(len(self.interior_lons))])
else:
shp = shapely.geometry.Polygon(list(zip(self.lons, self.lats, self.z)))
return shp
def get_ogr_geomtype(self):
return ogr.wkbPolygon
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment