Commit 9e59054a authored by Aurelien Vermylen's avatar Aurelien Vermylen

Fix bug that MultiGeometry cannot contain another MultiGeometry.

parent 2206a1bc
......@@ -19,27 +19,19 @@
Import the geometries from shapely if it is installed or otherwise from Pygeoif
"""
try:
from shapely.geometry import Point, LineString, Polygon
from shapely.geometry import MultiPoint, MultiLineString, MultiPolygon
from shapely.geometry.polygon import LinearRing
# from shapely.geometry import GeometryCollection
# Sean Gillies:
# I deliberately omitted a geometry collection constructor because
# there was almost no support in GEOS for operations on them. You
# couldn't buffer a collection, for example, or find its difference
# to another geometry. I've seen some signs of this changing in GEOS,
# but until it does I don't think there's any point to the class.
# It wouldn't be much more than a list of geometries.
from pygeoif.geometry import GeometryCollection
from shapely.geometry import asShape
except ImportError:
from pygeoif.geometry import Point, LineString, Polygon
from pygeoif.geometry import MultiPoint, MultiLineString, MultiPolygon
from pygeoif.geometry import LinearRing
from pygeoif.geometry import GeometryCollection
from pygeoif.geometry import as_shape as asShape
from shapely.geometry import Point, LineString, Polygon
from shapely.geometry import MultiPoint, MultiLineString, MultiPolygon
from shapely.geometry.polygon import LinearRing
# from shapely.geometry import GeometryCollection
# Sean Gillies:
# I deliberately omitted a geometry collection constructor because
# there was almost no support in GEOS for operations on them. You
# couldn't buffer a collection, for example, or find its difference
# to another geometry. I've seen some signs of this changing in GEOS,
# but until it does I don't think there's any point to the class.
# It wouldn't be much more than a list of geometries.
from pygeoif.geometry import GeometryCollection
from shapely.geometry import asShape
import re
import fastkml.config as config
......@@ -393,6 +385,11 @@ class Geometry(_BaseObject):
for lr in linearings:
self._get_geometry_spec(lr)
geoms.append(LinearRing(self._get_coordinates(lr)))
multigeometries = element.findall('%sMultiGeometry' % self.ns)
if multigeometries:
for mg in multigeometries:
geoms.append(self._get_multigeometry(mg))
if len(geoms) > 0:
geom_types = []
for geom in geoms:
......
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