/usr/share/pyshared/shapely/geometry/collection.py is in python-shapely 1.2.14-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | """Multi-part collections of geometries
"""
from shapely.geometry.base import BaseMultipartGeometry
from shapely.geometry.base import HeterogeneousGeometrySequence
class GeometryCollection(BaseMultipartGeometry):
"""A heterogenous collection of geometries
Attributes
----------
geoms : sequence
A sequence of Shapely geometry instances
"""
def __init__(self):
BaseMultipartGeometry.__init__(self)
@property
def __geo_interface__(self):
geometries = []
for geom in self.geoms:
geometries.append(geom.__geo_interface__)
return dict(type='GeometryCollection', geometries=geometries)
@property
def geoms(self):
if self.is_empty:
return []
return HeterogeneousGeometrySequence(self)
# Test runner
def _test():
import doctest
doctest.testmod()
if __name__ == "__main__":
_test()
|