shapely 1.0.5__tar.gz → 1.0.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {Shapely-1.0.5 → Shapely-1.0.7}/CHANGES.txt +12 -1
- {Shapely-1.0.5 → Shapely-1.0.7}/CREDITS.txt +0 -1
- {Shapely-1.0.5 → Shapely-1.0.7}/PKG-INFO +6 -4
- {Shapely-1.0.5 → Shapely-1.0.7}/README.txt +4 -2
- {Shapely-1.0.5 → Shapely-1.0.7}/Shapely.egg-info/PKG-INFO +6 -4
- {Shapely-1.0.5 → Shapely-1.0.7}/Shapely.egg-info/SOURCES.txt +1 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/setup.py +2 -4
- {Shapely-1.0.5 → Shapely-1.0.7}/setup_windows.py +3 -5
- {Shapely-1.0.5 → Shapely-1.0.7}/shapely/geometry/base.py +2 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/shapely/geometry/geo.py +3 -3
- {Shapely-1.0.5 → Shapely-1.0.7}/shapely/geometry/multipolygon.py +24 -4
- {Shapely-1.0.5 → Shapely-1.0.7}/shapely/geometry/polygon.py +33 -20
- {Shapely-1.0.5 → Shapely-1.0.7}/shapely/predicates.py +4 -2
- {Shapely-1.0.5 → Shapely-1.0.7}/tests/GeoInterface.txt +1 -1
- {Shapely-1.0.5 → Shapely-1.0.7}/tests/Polygon.txt +0 -1
- Shapely-1.0.7/tests/dimensions.txt +17 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/HISTORY.txt +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/LICENSE.txt +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/Shapely.egg-info/dependency_links.txt +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/Shapely.egg-info/requires.txt +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/Shapely.egg-info/top_level.txt +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/examples/geoms.py +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/examples/world.py +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/manual/manual.txt +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/manual/style.css +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/setup.cfg +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/shapely/__init__.py +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/shapely/geometry/__init__.py +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/shapely/geometry/collection.py +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/shapely/geometry/linestring.py +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/shapely/geometry/multilinestring.py +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/shapely/geometry/multipoint.py +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/shapely/geometry/point.py +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/shapely/geometry/proxy.py +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/shapely/geos.py +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/shapely/iterops.py +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/shapely/kml.py +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/shapely/ops.py +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/shapely/topology.py +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/shapely/wkb.py +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/shapely/wkt.py +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/tests/Array.txt +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/tests/IterOps.txt +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/tests/LineString.txt +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/tests/MultiLineString.txt +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/tests/MultiPoint.txt +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/tests/MultiPolygon.txt +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/tests/Operations.txt +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/tests/Persist.txt +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/tests/Point.txt +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/tests/Predicates.txt +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/tests/__init__.py +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/tests/attribute-chains.txt +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/tests/binascii_hex.txt +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/tests/invalid_intersection.txt +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/tests/polygonize.txt +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/tests/rungrind.dist +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/tests/test_doctests.py +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/tests/test_threads.py +0 -0
- {Shapely-1.0.5 → Shapely-1.0.7}/tests/valgrind-python.supp +0 -0
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
All tickets are children of http://trac.gispython.org/
|
|
1
|
+
All tickets are children of http://trac.gispython.org/lab/ticket.
|
|
2
|
+
|
|
3
|
+
1.0.7 (2008-08-22)
|
|
4
|
+
------------------
|
|
5
|
+
- Polygon rings now have the same dimensions as parent (#168).
|
|
6
|
+
- Eliminated reference cycles in polygons (#169).
|
|
7
|
+
|
|
8
|
+
1.0.6 (2008-07-10)
|
|
9
|
+
------------------
|
|
10
|
+
- Fixed adaptation of multi polygon data.
|
|
11
|
+
- Raise exceptions earlier from binary predicates.
|
|
12
|
+
- Beginning distributing new windows DLLs (#166).
|
|
2
13
|
|
|
3
14
|
1.0.5 (2008-05-20)
|
|
4
15
|
------------------
|
|
@@ -4,7 +4,6 @@ Kai Lautaportti (Hexagon IT)
|
|
|
4
4
|
Frédéric Junod (Camptocamp SA)
|
|
5
5
|
Eric Lemoine (Camptocamp SA)
|
|
6
6
|
Justin Bronn (GeoDjango) for ctypes inspiration
|
|
7
|
-
Artem Pavlenko (Mapnik) for help with GEOS DLLs
|
|
8
7
|
|
|
9
8
|
Some of this work was supported by a grant from the U.S. National Endowment for
|
|
10
9
|
the Humanities (http://www.neh.gov).
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 1.0
|
|
2
2
|
Name: Shapely
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.7
|
|
4
4
|
Summary: Geospatial geometries, predicates, and operations
|
|
5
|
-
Home-page: http://trac.gispython.org/
|
|
5
|
+
Home-page: http://trac.gispython.org/lab/wiki/Shapely
|
|
6
6
|
Author: Sean Gillies
|
|
7
7
|
Author-email: sgillies@frii.com
|
|
8
8
|
License: BSD
|
|
@@ -21,6 +21,10 @@ Description: Shapely
|
|
|
21
21
|
Shapely requires Python 2.4+. (I've also begun to port it to Python 3.0:
|
|
22
22
|
http://zcologia.com/news/564/shapely-for-python-3-0/.)
|
|
23
23
|
|
|
24
|
+
.. note::
|
|
25
|
+
We've switched to Windows GEOS DLLs based on MinGW in versions >= 1.0.6.
|
|
26
|
+
Please contact us if you experience difficulties.
|
|
27
|
+
|
|
24
28
|
See also CHANGES.txt_ and HISTORY.txt_.
|
|
25
29
|
|
|
26
30
|
.. _CHANGES.txt: http://trac.gispython.org/projects/PCL/browser/Shapely/trunk/CHANGES.txt
|
|
@@ -161,7 +165,6 @@ Description: Shapely
|
|
|
161
165
|
* Fr |eaigue| d |eaigue| ric Junod (Camptocamp SA)
|
|
162
166
|
* Eric Lemoine (Camptocamp SA)
|
|
163
167
|
* Justin Bronn (GeoDjango) for ctypes inspiration
|
|
164
|
-
* Artem Pavlenko (Mapnik) for help with GEOS DLLs
|
|
165
168
|
|
|
166
169
|
.. |eaigue| unicode:: U+00E9
|
|
167
170
|
:trim:
|
|
@@ -169,7 +172,6 @@ Description: Shapely
|
|
|
169
172
|
Major portions of this work were supported by a grant (to Pleiades) from the
|
|
170
173
|
U.S. National Endowment for the Humanities (http://www.neh.gov).
|
|
171
174
|
|
|
172
|
-
|
|
173
175
|
Keywords: geometry topology
|
|
174
176
|
Platform: UNKNOWN
|
|
175
177
|
Classifier: Development Status :: 5 - Production/Stable
|
|
@@ -13,6 +13,10 @@ to other packages like WorldMill_ and pyproj_. For more information, see:
|
|
|
13
13
|
Shapely requires Python 2.4+. (I've also begun to port it to Python 3.0:
|
|
14
14
|
http://zcologia.com/news/564/shapely-for-python-3-0/.)
|
|
15
15
|
|
|
16
|
+
.. note::
|
|
17
|
+
We've switched to Windows GEOS DLLs based on MinGW in versions >= 1.0.6.
|
|
18
|
+
Please contact us if you experience difficulties.
|
|
19
|
+
|
|
16
20
|
See also CHANGES.txt_ and HISTORY.txt_.
|
|
17
21
|
|
|
18
22
|
.. _CHANGES.txt: http://trac.gispython.org/projects/PCL/browser/Shapely/trunk/CHANGES.txt
|
|
@@ -153,11 +157,9 @@ Credits
|
|
|
153
157
|
* Fr |eaigue| d |eaigue| ric Junod (Camptocamp SA)
|
|
154
158
|
* Eric Lemoine (Camptocamp SA)
|
|
155
159
|
* Justin Bronn (GeoDjango) for ctypes inspiration
|
|
156
|
-
* Artem Pavlenko (Mapnik) for help with GEOS DLLs
|
|
157
160
|
|
|
158
161
|
.. |eaigue| unicode:: U+00E9
|
|
159
162
|
:trim:
|
|
160
163
|
|
|
161
164
|
Major portions of this work were supported by a grant (to Pleiades) from the
|
|
162
165
|
U.S. National Endowment for the Humanities (http://www.neh.gov).
|
|
163
|
-
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 1.0
|
|
2
2
|
Name: Shapely
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.7
|
|
4
4
|
Summary: Geospatial geometries, predicates, and operations
|
|
5
|
-
Home-page: http://trac.gispython.org/
|
|
5
|
+
Home-page: http://trac.gispython.org/lab/wiki/Shapely
|
|
6
6
|
Author: Sean Gillies
|
|
7
7
|
Author-email: sgillies@frii.com
|
|
8
8
|
License: BSD
|
|
@@ -21,6 +21,10 @@ Description: Shapely
|
|
|
21
21
|
Shapely requires Python 2.4+. (I've also begun to port it to Python 3.0:
|
|
22
22
|
http://zcologia.com/news/564/shapely-for-python-3-0/.)
|
|
23
23
|
|
|
24
|
+
.. note::
|
|
25
|
+
We've switched to Windows GEOS DLLs based on MinGW in versions >= 1.0.6.
|
|
26
|
+
Please contact us if you experience difficulties.
|
|
27
|
+
|
|
24
28
|
See also CHANGES.txt_ and HISTORY.txt_.
|
|
25
29
|
|
|
26
30
|
.. _CHANGES.txt: http://trac.gispython.org/projects/PCL/browser/Shapely/trunk/CHANGES.txt
|
|
@@ -161,7 +165,6 @@ Description: Shapely
|
|
|
161
165
|
* Fr |eaigue| d |eaigue| ric Junod (Camptocamp SA)
|
|
162
166
|
* Eric Lemoine (Camptocamp SA)
|
|
163
167
|
* Justin Bronn (GeoDjango) for ctypes inspiration
|
|
164
|
-
* Artem Pavlenko (Mapnik) for help with GEOS DLLs
|
|
165
168
|
|
|
166
169
|
.. |eaigue| unicode:: U+00E9
|
|
167
170
|
:trim:
|
|
@@ -169,7 +172,6 @@ Description: Shapely
|
|
|
169
172
|
Major portions of this work were supported by a grant (to Pleiades) from the
|
|
170
173
|
U.S. National Endowment for the Humanities (http://www.neh.gov).
|
|
171
174
|
|
|
172
|
-
|
|
173
175
|
Keywords: geometry topology
|
|
174
176
|
Platform: UNKNOWN
|
|
175
177
|
Classifier: Development Status :: 5 - Production/Stable
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
from setuptools import setup, Extension
|
|
3
2
|
from sys import version_info
|
|
4
3
|
|
|
@@ -11,7 +10,7 @@ if version_info[:2] < (2,5):
|
|
|
11
10
|
readme_text = file('README.txt', 'rb').read()
|
|
12
11
|
|
|
13
12
|
setup(name = 'Shapely',
|
|
14
|
-
version = '1.0.
|
|
13
|
+
version = '1.0.7',
|
|
15
14
|
description = 'Geospatial geometries, predicates, and operations',
|
|
16
15
|
license = 'BSD',
|
|
17
16
|
keywords = 'geometry topology',
|
|
@@ -19,7 +18,7 @@ setup(name = 'Shapely',
|
|
|
19
18
|
author_email = 'sgillies@frii.com',
|
|
20
19
|
maintainer = 'Sean Gillies',
|
|
21
20
|
maintainer_email = 'sgillies@frii.com',
|
|
22
|
-
url = 'http://trac.gispython.org/
|
|
21
|
+
url = 'http://trac.gispython.org/lab/wiki/Shapely',
|
|
23
22
|
long_description = readme_text,
|
|
24
23
|
packages = ['shapely', 'shapely.geometry'],
|
|
25
24
|
install_requires = install_requires,
|
|
@@ -35,4 +34,3 @@ setup(name = 'Shapely',
|
|
|
35
34
|
'Topic :: Scientific/Engineering :: GIS',
|
|
36
35
|
],
|
|
37
36
|
)
|
|
38
|
-
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
from setuptools import setup, Extension
|
|
3
2
|
from sys import version_info
|
|
4
3
|
|
|
@@ -11,7 +10,7 @@ if version_info[:2] < (2,5):
|
|
|
11
10
|
readme_text = file('README.txt', 'rb').read()
|
|
12
11
|
|
|
13
12
|
setup(name = 'Shapely',
|
|
14
|
-
version = '1.0.
|
|
13
|
+
version = '1.0.7',
|
|
15
14
|
description = 'Geospatial geometries, predicates, and operations',
|
|
16
15
|
license = 'BSD',
|
|
17
16
|
keywords = 'geometry topology',
|
|
@@ -19,10 +18,10 @@ setup(name = 'Shapely',
|
|
|
19
18
|
author_email = 'sgillies@frii.com',
|
|
20
19
|
maintainer = 'Sean Gillies',
|
|
21
20
|
maintainer_email = 'sgillies@frii.com',
|
|
22
|
-
url = 'http://trac.gispython.org/
|
|
21
|
+
url = 'http://trac.gispython.org/lab/wiki/Shapely',
|
|
23
22
|
long_description = readme_text,
|
|
24
23
|
packages = ['shapely', 'shapely.geometry'],
|
|
25
|
-
data_files=[('DLLs', ['DLLs/geos.dll']),],
|
|
24
|
+
data_files=[('DLLs', ['DLLs/geos.dll', 'DLLs/libgeos-3-0-0.dll']),],
|
|
26
25
|
install_requires = install_requires,
|
|
27
26
|
#tests_require = ['numpy'], -- not working with "tests" command
|
|
28
27
|
test_suite = 'tests.test_suite',
|
|
@@ -36,4 +35,3 @@ setup(name = 'Shapely',
|
|
|
36
35
|
'Topic :: Scientific/Engineering :: GIS',
|
|
37
36
|
],
|
|
38
37
|
)
|
|
39
|
-
|
|
@@ -7,7 +7,7 @@ from linestring import LineString, asLineString
|
|
|
7
7
|
from polygon import Polygon, asPolygon
|
|
8
8
|
from multipoint import MultiPoint, asMultiPoint
|
|
9
9
|
from multilinestring import MultiLineString, asMultiLineString
|
|
10
|
-
from multipolygon import MultiPolygon, asMultiPolygon
|
|
10
|
+
from multipolygon import MultiPolygon, MultiPolygonAdapter, asMultiPolygon
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
def shape(context):
|
|
@@ -30,7 +30,7 @@ def shape(context):
|
|
|
30
30
|
elif geom_type == "multilinestring":
|
|
31
31
|
return MultiLineString(ob["coordinates"])
|
|
32
32
|
elif geom_type == "multipolygon":
|
|
33
|
-
return MultiPolygon(ob["coordinates"])
|
|
33
|
+
return MultiPolygon(ob["coordinates"], context_type='geojson')
|
|
34
34
|
else:
|
|
35
35
|
raise ValueError, "Unknown geometry type: %s" % geom_type
|
|
36
36
|
|
|
@@ -59,6 +59,6 @@ def asShape(context):
|
|
|
59
59
|
elif geom_type == "multilinestring":
|
|
60
60
|
return asMultiLineString(ob["coordinates"])
|
|
61
61
|
elif geom_type == "multipolygon":
|
|
62
|
-
return
|
|
62
|
+
return MultiPolygonAdapter(ob["coordinates"], context_type='geojson')
|
|
63
63
|
else:
|
|
64
64
|
raise ValueError, "Unknown geometry type: %s" % geom_type
|
|
@@ -11,6 +11,20 @@ from shapely.geometry.proxy import CachingGeometryProxy
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
def geos_multipolygon_from_py(ob):
|
|
14
|
+
"""ob must provide Python geo interface coordinates."""
|
|
15
|
+
L = len(ob)
|
|
16
|
+
N = len(ob[0][0][0])
|
|
17
|
+
assert L >= 1
|
|
18
|
+
assert N == 2 or N == 3
|
|
19
|
+
|
|
20
|
+
subs = (c_void_p * L)()
|
|
21
|
+
for l in xrange(L):
|
|
22
|
+
geom, ndims = geos_polygon_from_py(ob[l][0], ob[l][1:])
|
|
23
|
+
subs[l] = cast(geom, c_void_p)
|
|
24
|
+
|
|
25
|
+
return (lgeos.GEOSGeom_createCollection(6, subs, L), N)
|
|
26
|
+
|
|
27
|
+
def geos_multipolygon_from_polygons(ob):
|
|
14
28
|
"""ob must be either a sequence or array of sequences or arrays."""
|
|
15
29
|
L = len(ob)
|
|
16
30
|
N = len(ob[0][0][0])
|
|
@@ -25,12 +39,13 @@ def geos_multipolygon_from_py(ob):
|
|
|
25
39
|
return (lgeos.GEOSGeom_createCollection(6, subs, L), N)
|
|
26
40
|
|
|
27
41
|
|
|
42
|
+
|
|
28
43
|
class MultiPolygon(BaseGeometry):
|
|
29
44
|
|
|
30
45
|
"""a multiple polygon geometry.
|
|
31
46
|
"""
|
|
32
47
|
|
|
33
|
-
def __init__(self, polygons=None):
|
|
48
|
+
def __init__(self, polygons=None, context_type='polygons'):
|
|
34
49
|
"""Initialize.
|
|
35
50
|
|
|
36
51
|
Parameters
|
|
@@ -55,7 +70,9 @@ class MultiPolygon(BaseGeometry):
|
|
|
55
70
|
if polygons is None:
|
|
56
71
|
# allow creation of null collections, to support unpickling
|
|
57
72
|
pass
|
|
58
|
-
|
|
73
|
+
elif context_type == 'polygons':
|
|
74
|
+
self._geom, self._ndim = geos_multipolygon_from_polygons(polygons)
|
|
75
|
+
elif context_type == 'geojson':
|
|
59
76
|
self._geom, self._ndim = geos_multipolygon_from_py(polygons)
|
|
60
77
|
|
|
61
78
|
@property
|
|
@@ -111,9 +128,12 @@ class MultiPolygonAdapter(CachingGeometryProxy, MultiPolygon):
|
|
|
111
128
|
context = None
|
|
112
129
|
_owned = False
|
|
113
130
|
|
|
114
|
-
def __init__(self, context):
|
|
131
|
+
def __init__(self, context, context_type='polygons'):
|
|
115
132
|
self.context = context
|
|
116
|
-
|
|
133
|
+
if context_type == 'geojson':
|
|
134
|
+
self.factory = geos_multipolygon_from_py
|
|
135
|
+
elif context_type == 'polygons':
|
|
136
|
+
self.factory = geos_multipolygon_from_polygons
|
|
117
137
|
|
|
118
138
|
@property
|
|
119
139
|
def _ndim(self):
|
|
@@ -3,7 +3,7 @@ Polygons and their linear ring components.
|
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
5
|
from ctypes import byref, c_double, c_int, c_void_p, cast, POINTER, pointer
|
|
6
|
-
|
|
6
|
+
import weakref
|
|
7
7
|
from shapely.geos import lgeos
|
|
8
8
|
from shapely.geometry.base import BaseGeometry, exceptNull
|
|
9
9
|
from shapely.geometry.linestring import LineString, LineStringAdapter
|
|
@@ -143,7 +143,7 @@ class LinearRing(LineString):
|
|
|
143
143
|
"""A linear ring.
|
|
144
144
|
"""
|
|
145
145
|
|
|
146
|
-
_ndim =
|
|
146
|
+
_ndim = None
|
|
147
147
|
__geom__ = None
|
|
148
148
|
__p__ = None
|
|
149
149
|
_owned = False
|
|
@@ -233,6 +233,8 @@ class InteriorRingSequence(object):
|
|
|
233
233
|
_ndim = None
|
|
234
234
|
_index = 0
|
|
235
235
|
_length = 0
|
|
236
|
+
__rings__ = None
|
|
237
|
+
_gtag = None
|
|
236
238
|
|
|
237
239
|
def __init__(self, parent):
|
|
238
240
|
self.__p__ = parent
|
|
@@ -246,11 +248,9 @@ class InteriorRingSequence(object):
|
|
|
246
248
|
|
|
247
249
|
def next(self):
|
|
248
250
|
if self._index < self._length:
|
|
249
|
-
|
|
250
|
-
g._owned = True
|
|
251
|
-
g._geom = lgeos.GEOSGetInteriorRingN(self._geom, self._index)
|
|
251
|
+
ring = self._get_ring(self._index)
|
|
252
252
|
self._index += 1
|
|
253
|
-
return
|
|
253
|
+
return ring
|
|
254
254
|
else:
|
|
255
255
|
raise StopIteration
|
|
256
256
|
|
|
@@ -265,10 +265,7 @@ class InteriorRingSequence(object):
|
|
|
265
265
|
ii = M + i
|
|
266
266
|
else:
|
|
267
267
|
ii = i
|
|
268
|
-
|
|
269
|
-
g._owned = True
|
|
270
|
-
g._geom = lgeos.GEOSGetInteriorRingN(self._geom, ii)
|
|
271
|
-
return g
|
|
268
|
+
return self._get_ring(i)
|
|
272
269
|
|
|
273
270
|
@property
|
|
274
271
|
def _longest(self):
|
|
@@ -278,6 +275,23 @@ class InteriorRingSequence(object):
|
|
|
278
275
|
if l > max:
|
|
279
276
|
max = l
|
|
280
277
|
|
|
278
|
+
def gtag(self):
|
|
279
|
+
return hash(repr(self.__p__))
|
|
280
|
+
|
|
281
|
+
def _get_ring(self, i):
|
|
282
|
+
gtag = self.gtag()
|
|
283
|
+
if gtag != self._gtag:
|
|
284
|
+
self.__rings__ = {}
|
|
285
|
+
if i not in self.__rings__:
|
|
286
|
+
g = lgeos.GEOSGetInteriorRingN(self._geom, i)
|
|
287
|
+
ring = LinearRing()
|
|
288
|
+
ring.__geom__ = g
|
|
289
|
+
ring.__p__ = self
|
|
290
|
+
ring._owned = True
|
|
291
|
+
ring._ndim = self._ndim
|
|
292
|
+
self.__rings__[i] = weakref.ref(ring)
|
|
293
|
+
return self.__rings__[i]()
|
|
294
|
+
|
|
281
295
|
|
|
282
296
|
def geos_polygon_from_py(shell, holes=None):
|
|
283
297
|
if shell is not None:
|
|
@@ -344,16 +358,15 @@ class Polygon(BaseGeometry):
|
|
|
344
358
|
@property
|
|
345
359
|
@exceptNull
|
|
346
360
|
def exterior(self):
|
|
347
|
-
if self._exterior is None:
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
ring =
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
self.
|
|
355
|
-
|
|
356
|
-
return self._exterior
|
|
361
|
+
if self._exterior is None or self._exterior() is None:
|
|
362
|
+
g = lgeos.GEOSGetExteriorRing(self._geom)
|
|
363
|
+
ring = LinearRing()
|
|
364
|
+
ring.__geom__ = g
|
|
365
|
+
ring.__p__ = self
|
|
366
|
+
ring._owned = True
|
|
367
|
+
ring._ndim = self._ndim
|
|
368
|
+
self._exterior = weakref.ref(ring)
|
|
369
|
+
return self._exterior()
|
|
357
370
|
|
|
358
371
|
@property
|
|
359
372
|
@exceptNull
|
|
@@ -23,12 +23,14 @@ class BinaryPredicate(object):
|
|
|
23
23
|
self.fn.errcheck = errcheck
|
|
24
24
|
|
|
25
25
|
def __get__(self, obj, objtype=None):
|
|
26
|
+
if not obj._geom:
|
|
27
|
+
raise ValueError, "Null geometry supports no operations"
|
|
26
28
|
self.context = obj
|
|
27
29
|
return self
|
|
28
30
|
|
|
29
31
|
def __call__(self, other):
|
|
30
|
-
if not
|
|
31
|
-
raise ValueError, "Null geometry
|
|
32
|
+
if not other._geom:
|
|
33
|
+
raise ValueError, "Null geometry can not be operated upon"
|
|
32
34
|
return bool(self.fn(self.context._geom, other._geom))
|
|
33
35
|
|
|
34
36
|
|
|
@@ -61,7 +61,7 @@ Test implementation of geo interface
|
|
|
61
61
|
|
|
62
62
|
multi polygon
|
|
63
63
|
|
|
64
|
-
>>> shape = asShape({'type': 'MultiPolygon', 'coordinates': [(((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0), (0.0, 0.0)),
|
|
64
|
+
>>> shape = asShape({'type': 'MultiPolygon', 'coordinates': [(((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0), (0.0, 0.0)), ((0.10000000000000001, 0.10000000000000001), (0.10000000000000001, 0.20000000000000001), (0.20000000000000001, 0.20000000000000001), (0.20000000000000001, 0.10000000000000001), (0.10000000000000001, 0.10000000000000001)))]})
|
|
65
65
|
>>> shape # doctest: +ELLIPSIS
|
|
66
66
|
<shapely.geometry.multipolygon.MultiPolygonAdapter object at ...>
|
|
67
67
|
>>> len(shape.geoms)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Background: see http://trac.gispython.org/lab/ticket/168
|
|
2
|
+
|
|
3
|
+
>>> from shapely.geometry import Polygon
|
|
4
|
+
>>> coords = ((0.0, 0.0, 0.0), (0.0, 1.0, 0.0), (1.0, 1.0, 0.0), (1.0, 0.0, 0.0))
|
|
5
|
+
>>> polygon = Polygon(coords)
|
|
6
|
+
>>> polygon._ndim
|
|
7
|
+
3
|
|
8
|
+
>>> gi = polygon.__geo_interface__
|
|
9
|
+
>>> gi['coordinates']
|
|
10
|
+
(((0.0, 0.0, 0.0), (0.0, 1.0, 0.0), (1.0, 1.0, 0.0), (1.0, 0.0, 0.0), (0.0, 0.0, 0.0)),)
|
|
11
|
+
|
|
12
|
+
>>> e = polygon.exterior
|
|
13
|
+
>>> e._ndim
|
|
14
|
+
3
|
|
15
|
+
>>> gi = e.__geo_interface__
|
|
16
|
+
>>> gi['coordinates']
|
|
17
|
+
((0.0, 0.0, 0.0), (0.0, 1.0, 0.0), (1.0, 1.0, 0.0), (1.0, 0.0, 0.0), (0.0, 0.0, 0.0))
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|