Permalink
Browse files

Change Multi* creation behavior to produce empty geometries if points…

…/lines/polygons are False, i.e., either None or []
  • Loading branch information...
1 parent e41ad11 commit 8a6bf46b046137c12a2256aa5fb6cc692157b022 @mwtoews committed Jan 17, 2012
Showing with 5 additions and 5 deletions.
  1. +2 −2 shapely/geometry/multilinestring.py
  2. +1 −1 shapely/geometry/multipoint.py
  3. +2 −2 shapely/geometry/multipolygon.py
@@ -40,8 +40,8 @@ def __init__(self, lines=None):
"""
super(MultiLineString, self).__init__()
- if lines is None:
- # allow creation of null lines, to support unpickling
+ if not lines:
+ # allow creation of empty multilinestrings, to support unpickling
pass
else:
self._geom, self._ndim = geos_multilinestring_from_py(lines)
@@ -45,7 +45,7 @@ def __init__(self, points=None):
"""
super(MultiPoint, self).__init__()
- if points is None:
+ if not points:
# allow creation of empty multipoints, to support unpickling
pass
else:
@@ -50,8 +50,8 @@ def __init__(self, polygons=None, context_type='polygons'):
"""
super(MultiPolygon, self).__init__()
- if polygons is None:
- # allow creation of null collections, to support unpickling
+ if not polygons:
+ # allow creation of empty multipolygons, to support unpickling
pass
elif context_type == 'polygons':
self._geom, self._ndim = geos_multipolygon_from_polygons(polygons)

0 comments on commit 8a6bf46

Please sign in to comment.