shapely 1.2.12__py2.6-win-amd64.egg → 1.2.14__py2.6-win-amd64.egg
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.
- EGG-INFO/PKG-INFO +380 -372
- shapely/__init__.py +2 -1
- shapely/__init__.pyc +0 -0
- shapely/coords.py +38 -21
- shapely/coords.pyc +0 -0
- shapely/geometry/base.py +28 -16
- shapely/geometry/base.pyc +0 -0
- shapely/geometry/multilinestring.py +1 -1
- shapely/geometry/multilinestring.pyc +0 -0
- shapely/geometry/multipolygon.py +1 -1
- shapely/geometry/multipolygon.pyc +0 -0
- shapely/geometry/polygon.py +17 -8
- shapely/geometry/polygon.pyc +0 -0
- shapely/speedups/_speedups.pyc +0 -0
- shapely/speedups/_speedups.pyd +0 -0
- shapely/tests/__init__.py +2 -1
- shapely/tests/__init__.pyc +0 -0
- shapely/tests/test_getitem.py +113 -0
- shapely/tests/test_getitem.pyc +0 -0
EGG-INFO/PKG-INFO
CHANGED
|
@@ -1,381 +1,389 @@
|
|
|
1
1
|
Metadata-Version: 1.0
|
|
2
2
|
Name: Shapely
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.14
|
|
4
4
|
Summary: Geometric objects, predicates, and operations
|
|
5
|
-
Home-page:
|
|
5
|
+
Home-page: https://github.com/sgillies/shapely
|
|
6
6
|
Author: Sean Gillies
|
|
7
7
|
Author-email: sean.gillies@gmail.com
|
|
8
8
|
License: BSD
|
|
9
|
-
Description: ======
|
|
10
|
-
README
|
|
11
|
-
======
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
* Shapely
|
|
28
|
-
* Shapely
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
*
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
for
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
*
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
..
|
|
156
|
-
..
|
|
157
|
-
..
|
|
158
|
-
..
|
|
159
|
-
..
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
-
|
|
173
|
-
|
|
174
|
-
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
-
|
|
182
|
-
-
|
|
183
|
-
|
|
184
|
-
1.2.
|
|
185
|
-
|
|
186
|
-
-
|
|
187
|
-
|
|
188
|
-
-
|
|
189
|
-
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
(#
|
|
211
|
-
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
-
|
|
222
|
-
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
- Add
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
1.
|
|
288
|
-
------------------
|
|
289
|
-
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
1.
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
1.0.
|
|
322
|
-
|
|
323
|
-
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
1.0.
|
|
352
|
-
------------------
|
|
353
|
-
-
|
|
354
|
-
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
-
|
|
374
|
-
|
|
375
|
-
1.0
|
|
376
|
-
|
|
377
|
-
-
|
|
378
|
-
|
|
9
|
+
Description: ======
|
|
10
|
+
README
|
|
11
|
+
======
|
|
12
|
+
|
|
13
|
+
PostGIS-ish operations outside a database context for Pythoneers and
|
|
14
|
+
Pythonistas.
|
|
15
|
+
|
|
16
|
+
.. image:: http://farm3.static.flickr.com/2738/4511827859_b5822043b7_o_d.png
|
|
17
|
+
:width: 800
|
|
18
|
+
:height: 400
|
|
19
|
+
|
|
20
|
+
Shapely is a BSD-licensed Python package for manipulation and analysis of
|
|
21
|
+
planar geometric objects. It is based on the widely deployed GEOS_ (the engine
|
|
22
|
+
of PostGIS_) and JTS_ (from which GEOS is ported) libraries. This C dependency
|
|
23
|
+
is traded for the ability to execute with blazing speed. Shapely is not
|
|
24
|
+
concerned with data formats or coordinate systems, but can be readily
|
|
25
|
+
integrated with packages that are. For more details, see:
|
|
26
|
+
|
|
27
|
+
* Shapely wiki_
|
|
28
|
+
* Shapely manual_
|
|
29
|
+
* Shapely `example apps`_
|
|
30
|
+
|
|
31
|
+
Dependencies
|
|
32
|
+
============
|
|
33
|
+
|
|
34
|
+
Shapely 1.2 depends on:
|
|
35
|
+
|
|
36
|
+
* Python >=2.5,<3
|
|
37
|
+
* libgeos_c >=3.1 (3.0 and below have not been tested, YMMV)
|
|
38
|
+
|
|
39
|
+
Installation
|
|
40
|
+
============
|
|
41
|
+
|
|
42
|
+
Windows users should use the executable installer, which contains the required
|
|
43
|
+
GEOS DLL. Other users should acquire libgeos_c by any means, make sure that it
|
|
44
|
+
is on the system library path, and install from the Python package index::
|
|
45
|
+
|
|
46
|
+
$ pip install Shapely
|
|
47
|
+
|
|
48
|
+
or from a source distribution with the setup script::
|
|
49
|
+
|
|
50
|
+
$ python setup.py install
|
|
51
|
+
|
|
52
|
+
Usage
|
|
53
|
+
=====
|
|
54
|
+
|
|
55
|
+
Here is the canonical example of building an approximately circular patch by
|
|
56
|
+
buffering a point::
|
|
57
|
+
|
|
58
|
+
>>> from shapely.geometry import Point
|
|
59
|
+
>>> patch = Point(0.0, 0.0).buffer(10.0)
|
|
60
|
+
>>> patch
|
|
61
|
+
<shapely.geometry.polygon.Polygon object at 0x...>
|
|
62
|
+
>>> patch.area
|
|
63
|
+
313.65484905459385
|
|
64
|
+
|
|
65
|
+
See the manual_ for comprehensive usage snippets and the dissolve.py and
|
|
66
|
+
intersect.py `example apps`_.
|
|
67
|
+
|
|
68
|
+
Integration
|
|
69
|
+
===========
|
|
70
|
+
|
|
71
|
+
Shapely does not read or write data files, but it can serialize and deserialize
|
|
72
|
+
using several well known formats and protocols. The shapely.wkb and shapely.wkt
|
|
73
|
+
modules provide dumpers and loaders inspired by Python's pickle module.::
|
|
74
|
+
|
|
75
|
+
>>> from shapely.wkt import dumps, loads
|
|
76
|
+
>>> dumps(loads('POINT (0 0)'))
|
|
77
|
+
'POINT (0.0000000000000000 0.0000000000000000)'
|
|
78
|
+
|
|
79
|
+
All linear objects, such as the rings of a polygon (like ``patch`` above),
|
|
80
|
+
provide the Numpy array interface.::
|
|
81
|
+
|
|
82
|
+
>>> from numpy import asarray
|
|
83
|
+
>>> ag = asarray(patch.exterior)
|
|
84
|
+
>>> ag
|
|
85
|
+
array([[ 1.00000000e+01, 0.00000000e+00],
|
|
86
|
+
[ 9.95184727e+00, -9.80171403e-01],
|
|
87
|
+
[ 9.80785280e+00, -1.95090322e+00],
|
|
88
|
+
...
|
|
89
|
+
[ 1.00000000e+01, 0.00000000e+00]])
|
|
90
|
+
|
|
91
|
+
That yields a numpy array of [x, y] arrays. This is not always exactly what one
|
|
92
|
+
wants for plotting shapes with Matplotlib (for example), so Shapely 1.2 adds
|
|
93
|
+
a `xy` property for obtaining separate arrays of coordinate x and y values.::
|
|
94
|
+
|
|
95
|
+
>>> x, y = patch.exterior.xy
|
|
96
|
+
>>> ax = asarray(x)
|
|
97
|
+
>>> ax
|
|
98
|
+
array([ 1.00000000e+01, 9.95184727e+00, 9.80785280e+00, ...])
|
|
99
|
+
|
|
100
|
+
Numpy arrays can also be adapted to Shapely linestrings::
|
|
101
|
+
|
|
102
|
+
>>> from shapely.geometry import asLineString
|
|
103
|
+
>>> asLineString(ag).length
|
|
104
|
+
62.806623139095073
|
|
105
|
+
>>> asLineString(ag).wkt
|
|
106
|
+
'LINESTRING (10.0000000000000000 0.0000000000000000, ...)'
|
|
107
|
+
|
|
108
|
+
Testing
|
|
109
|
+
=======
|
|
110
|
+
|
|
111
|
+
Shapely uses a Zope-stye suite of unittests and doctests, exercised via
|
|
112
|
+
setup.py.::
|
|
113
|
+
|
|
114
|
+
$ python setup.py test
|
|
115
|
+
|
|
116
|
+
Nosetests won't run the tests properly; Zope doctest suites are not currently
|
|
117
|
+
supported well by nose.
|
|
118
|
+
|
|
119
|
+
Support
|
|
120
|
+
=======
|
|
121
|
+
|
|
122
|
+
Bugs may be reported and questions asked via https://github.com/Toblerity/Shapely.
|
|
123
|
+
|
|
124
|
+
Credits
|
|
125
|
+
=======
|
|
126
|
+
|
|
127
|
+
Shapely is written by:
|
|
128
|
+
|
|
129
|
+
* Sean Gillies
|
|
130
|
+
* Aron Bierbaum
|
|
131
|
+
* Kai Lautaportti
|
|
132
|
+
* Oliver Tonnhofer
|
|
133
|
+
|
|
134
|
+
Patches contributed by:
|
|
135
|
+
|
|
136
|
+
* Howard Butler
|
|
137
|
+
* Frédéric Junod
|
|
138
|
+
* Éric Lemoine
|
|
139
|
+
* Jonathan Tartley
|
|
140
|
+
* Kristian Thy
|
|
141
|
+
* Mike Toews (https://github.com/mwtoews)
|
|
142
|
+
|
|
143
|
+
Additional help from:
|
|
144
|
+
|
|
145
|
+
* Justin Bronn (GeoDjango) for ctypes inspiration
|
|
146
|
+
* Martin Davis (JTS)
|
|
147
|
+
* Jaakko Salli for the Windows distributions
|
|
148
|
+
* Sandro Santilli, Mateusz Loskot, Paul Ramsey, et al (GEOS_ Project)
|
|
149
|
+
|
|
150
|
+
Major portions of this work were supported by a grant (for Pleiades_) from the
|
|
151
|
+
U.S. National Endowment for the Humanities (http://www.neh.gov).
|
|
152
|
+
|
|
153
|
+
.. _JTS: http://www.vividsolutions.com/jts/jtshome.htm
|
|
154
|
+
.. _PostGIS: http://postgis.org
|
|
155
|
+
.. _GEOS: http://trac.osgeo.org/geos/
|
|
156
|
+
.. _example apps: http://trac.gispython.org/lab/wiki/Examples
|
|
157
|
+
.. _wiki: http://trac.gispython.org/lab/wiki/Shapely
|
|
158
|
+
.. _manual: http://toblerity.github.com/shapely/manual.html
|
|
159
|
+
.. _Pleiades: http://pleiades.stoa.org
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
Changes
|
|
163
|
+
=======
|
|
164
|
+
|
|
165
|
+
1.2.14 (2012-01-23)
|
|
166
|
+
-------------------
|
|
167
|
+
- A geometry's coords property is now sliceable, yielding a list of coordinate
|
|
168
|
+
values.
|
|
169
|
+
- Homogeneous collections are now sliceable, yielding a new collection of the
|
|
170
|
+
same type.
|
|
171
|
+
|
|
172
|
+
1.2.13 (2011-09-16)
|
|
173
|
+
-------------------
|
|
174
|
+
- Fixed errors in speedups on 32bit systems when GEOS references memory above
|
|
175
|
+
2GB.
|
|
176
|
+
- Add shapely.__version__ attribute.
|
|
177
|
+
- Update the manual.
|
|
178
|
+
|
|
179
|
+
1.2.12 (2011-08-15)
|
|
180
|
+
-------------------
|
|
181
|
+
- Build Windows distributions with VC7 or VC9 as appropriate.
|
|
182
|
+
- More verbose report on failure to speed up.
|
|
183
|
+
- Fix for prepared geometries broken in 1.2.11.
|
|
184
|
+
- DO NOT INSTALL 1.2.11
|
|
185
|
+
|
|
186
|
+
1.2.11 (2011-08-04)
|
|
187
|
+
-------------------
|
|
188
|
+
- Ignore AttributeError during exit.
|
|
189
|
+
- PyPy 1.5 support.
|
|
190
|
+
- Prevent operation on prepared geometry crasher (#12).
|
|
191
|
+
- Optional Cython speedups for Windows.
|
|
192
|
+
- Linux 3 platform support.
|
|
193
|
+
|
|
194
|
+
1.2.10 (2011-05-09)
|
|
195
|
+
-------------------
|
|
196
|
+
- Add optional Cython speedups.
|
|
197
|
+
- Add is_cww predicate to LinearRing.
|
|
198
|
+
- Add function that forces orientation of Polygons.
|
|
199
|
+
- Disable build of speedups on Windows pending packaging work.
|
|
200
|
+
|
|
201
|
+
1.2.9 (2011-03-31)
|
|
202
|
+
------------------
|
|
203
|
+
- Remove extra glob import.
|
|
204
|
+
- Move examples to shapely.examples.
|
|
205
|
+
- Add box() constructor for rectangular polygons.
|
|
206
|
+
- Fix extraneous imports.
|
|
207
|
+
|
|
208
|
+
1.2.8 (2011-12-03)
|
|
209
|
+
------------------
|
|
210
|
+
- New parallel_offset method (#6).
|
|
211
|
+
- Support for Python 2.4.
|
|
212
|
+
|
|
213
|
+
1.2.7 (2010-11-05)
|
|
214
|
+
------------------
|
|
215
|
+
- Support for Windows eggs.
|
|
216
|
+
|
|
217
|
+
1.2.6 (2010-10-21)
|
|
218
|
+
------------------
|
|
219
|
+
- The geoms property of an empty collection yields [] instead of a ValueError
|
|
220
|
+
(#3).
|
|
221
|
+
- The coords and geometry type sproperties have the same behavior as above.
|
|
222
|
+
- Ensure that z values carry through into products of operations (#4).
|
|
223
|
+
|
|
224
|
+
1.2.5 (2010-09-19)
|
|
225
|
+
------------------
|
|
226
|
+
- Stop distributing docs/_build.
|
|
227
|
+
- Include library fallbacks in test_dlls.py for linux platform.
|
|
228
|
+
|
|
229
|
+
1.2.4 (2010-09-09)
|
|
230
|
+
------------------
|
|
231
|
+
- Raise AttributeError when there's no backend support for a method.
|
|
232
|
+
- Raise OSError if libgeos_c.so (or variants) can't be found and loaded.
|
|
233
|
+
- Add geos_c DLL loading support for linux platforms where find_library doesn't
|
|
234
|
+
work.
|
|
235
|
+
|
|
236
|
+
1.2.3 (2010-08-17)
|
|
237
|
+
------------------
|
|
238
|
+
- Add mapping function.
|
|
239
|
+
- Fix problem with GEOSisValidReason symbol for GEOS < 3.1.
|
|
240
|
+
|
|
241
|
+
1.2.2 (2010-07-23)
|
|
242
|
+
------------------
|
|
243
|
+
- Add representative_point method.
|
|
244
|
+
|
|
245
|
+
1.2.1 (2010-06-23)
|
|
246
|
+
------------------
|
|
247
|
+
- Fixed bounds of singular polygons.
|
|
248
|
+
- Added shapely.validation.explain_validity function (#226).
|
|
249
|
+
|
|
250
|
+
1.2 (2010-05-27)
|
|
251
|
+
----------------
|
|
252
|
+
- Final release.
|
|
253
|
+
|
|
254
|
+
1.2rc2 (2010-05-26)
|
|
255
|
+
-------------------
|
|
256
|
+
- Add examples and tests to MANIFEST.in.
|
|
257
|
+
- Release candidate 2.
|
|
258
|
+
|
|
259
|
+
1.2rc1 (2010-05-25)
|
|
260
|
+
-------------------
|
|
261
|
+
- Release candidate.
|
|
262
|
+
|
|
263
|
+
1.2b7 (2010-04-22)
|
|
264
|
+
------------------
|
|
265
|
+
- Memory leak associated with new empty geometry state fixed.
|
|
266
|
+
|
|
267
|
+
1.2b6 (2010-04-13)
|
|
268
|
+
------------------
|
|
269
|
+
- Broken GeometryCollection fixed.
|
|
270
|
+
|
|
271
|
+
1.2b5 (2010-04-09)
|
|
272
|
+
------------------
|
|
273
|
+
- Objects can be constructed from others of the same type, thereby making
|
|
274
|
+
copies. Collections can be constructed from sequences of objects, also making
|
|
275
|
+
copies.
|
|
276
|
+
- Collections are now iterators over their component objects.
|
|
277
|
+
- New code for manual figures, using the descartes package.
|
|
278
|
+
|
|
279
|
+
1.2b4 (2010-03-19)
|
|
280
|
+
------------------
|
|
281
|
+
- Adds support for the "sunos5" platform.
|
|
282
|
+
|
|
283
|
+
1.2b3 (2010-02-28)
|
|
284
|
+
------------------
|
|
285
|
+
- Only provide simplification implementations for GEOS C API >= 1.5.
|
|
286
|
+
|
|
287
|
+
1.2b2 (2010-02-19)
|
|
288
|
+
------------------
|
|
289
|
+
- Fix cascaded_union bug introduced in 1.2b1 (#212).
|
|
290
|
+
|
|
291
|
+
1.2b1 (2010-02-18)
|
|
292
|
+
------------------
|
|
293
|
+
- Update the README. Remove cruft from setup.py. Add some version 1.2 metadata
|
|
294
|
+
regarding required Python version (>=2.5,<3) and external dependency
|
|
295
|
+
(libgeos_c >= 3.1).
|
|
296
|
+
|
|
297
|
+
1.2a6 (2010-02-09)
|
|
298
|
+
------------------
|
|
299
|
+
- Add accessor for separate arrays of X and Y values (#210).
|
|
300
|
+
|
|
301
|
+
TODO: fill gap here
|
|
302
|
+
|
|
303
|
+
1.2a1 (2010-01-20)
|
|
304
|
+
------------------
|
|
305
|
+
- Proper prototyping of WKB writer, and avoidance of errors on 64-bit systems
|
|
306
|
+
(#191).
|
|
307
|
+
- Prototype libgeos_c functions in a way that lets py2exe apps import shapely
|
|
308
|
+
(#189).
|
|
309
|
+
|
|
310
|
+
1.2 Branched (2009-09-19)
|
|
311
|
+
|
|
312
|
+
1.0.12 (2009-04-09)
|
|
313
|
+
-------------------
|
|
314
|
+
- Fix for references held by topology and predicate descriptors.
|
|
315
|
+
|
|
316
|
+
1.0.11 (2008-11-20)
|
|
317
|
+
-------------------
|
|
318
|
+
- Work around bug in GEOS 2.2.3, GEOSCoordSeq_getOrdinate not exported properly
|
|
319
|
+
(#178).
|
|
320
|
+
|
|
321
|
+
1.0.10 (2008-11-17)
|
|
322
|
+
-------------------
|
|
323
|
+
- Fixed compatibility with GEOS 2.2.3 that was broken in 1.0.8 release (#176).
|
|
324
|
+
|
|
325
|
+
1.0.9 (2008-11-16)
|
|
326
|
+
------------------
|
|
327
|
+
- Find and load MacPorts libgeos.
|
|
328
|
+
|
|
329
|
+
1.0.8 (2008-11-01)
|
|
330
|
+
------------------
|
|
331
|
+
- Fill out GEOS function result and argument types to prevent faults on a
|
|
332
|
+
64-bit arch.
|
|
333
|
+
|
|
334
|
+
1.0.7 (2008-08-22)
|
|
335
|
+
------------------
|
|
336
|
+
- Polygon rings now have the same dimensions as parent (#168).
|
|
337
|
+
- Eliminated reference cycles in polygons (#169).
|
|
338
|
+
|
|
339
|
+
1.0.6 (2008-07-10)
|
|
340
|
+
------------------
|
|
341
|
+
- Fixed adaptation of multi polygon data.
|
|
342
|
+
- Raise exceptions earlier from binary predicates.
|
|
343
|
+
- Beginning distributing new windows DLLs (#166).
|
|
344
|
+
|
|
345
|
+
1.0.5 (2008-05-20)
|
|
346
|
+
------------------
|
|
347
|
+
- Added access to GEOS polygonizer function.
|
|
348
|
+
- Raise exception when insufficient coordinate tuples are passed to LinearRing
|
|
349
|
+
constructor (#164).
|
|
350
|
+
|
|
351
|
+
1.0.4 (2008-05-01)
|
|
352
|
+
------------------
|
|
353
|
+
- Disentangle Python and topological equality (#163).
|
|
354
|
+
- Add shape(), a factory that copies coordinates from a geo interface provider.
|
|
355
|
+
To be used instead of asShape() unless you really need to store coordinates
|
|
356
|
+
outside shapely for efficient use in other code.
|
|
357
|
+
- Cache GEOS geometries in adapters (#163).
|
|
358
|
+
|
|
359
|
+
1.0.3 (2008-04-09)
|
|
360
|
+
------------------
|
|
361
|
+
- Do not release GIL when calling GEOS functions (#158).
|
|
362
|
+
- Prevent faults when chaining multiple GEOS operators (#159).
|
|
363
|
+
|
|
364
|
+
1.0.2 (2008-02-26)
|
|
365
|
+
------------------
|
|
366
|
+
- Fix loss of dimensionality in polygon rings (#155).
|
|
367
|
+
|
|
368
|
+
1.0.1 (2008-02-08)
|
|
369
|
+
------------------
|
|
370
|
+
- Allow chaining expressions involving coordinate sequences and geometry parts
|
|
371
|
+
(#151).
|
|
372
|
+
- Protect against abnormal use of coordinate accessors (#152).
|
|
373
|
+
- Coordinate sequences now implement the numpy array protocol (#153).
|
|
374
|
+
|
|
375
|
+
1.0 (2008-01-18)
|
|
376
|
+
----------------
|
|
377
|
+
- Final release.
|
|
378
|
+
|
|
379
|
+
1.0 RC2 (2008-01-16)
|
|
380
|
+
--------------------
|
|
381
|
+
- Added temporary solution for #149.
|
|
382
|
+
|
|
383
|
+
1.0 RC1 (2008-01-14)
|
|
384
|
+
--------------------
|
|
385
|
+
- First release candidate
|
|
386
|
+
|
|
379
387
|
|
|
380
388
|
Keywords: geometry topology gis
|
|
381
389
|
Platform: UNKNOWN
|
shapely/__init__.py
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
__version__ = "1.2.14"
|
|
2
|
+
|
shapely/__init__.pyc
CHANGED
|
Binary file
|
shapely/coords.py
CHANGED
|
@@ -30,7 +30,7 @@ class CoordinateSequence(object):
|
|
|
30
30
|
# _ndim : int
|
|
31
31
|
# Number of dimensions (2 or 3, generally)
|
|
32
32
|
# __p__ : object
|
|
33
|
-
# Parent (Shapely) geometry
|
|
33
|
+
# Parent (Shapely) geometry
|
|
34
34
|
_cseq = None
|
|
35
35
|
_ndim = None
|
|
36
36
|
__p__ = None
|
|
@@ -41,7 +41,7 @@ class CoordinateSequence(object):
|
|
|
41
41
|
def _update(self):
|
|
42
42
|
self._ndim = self.__p__._ndim
|
|
43
43
|
self._cseq = lgeos.GEOSGeom_getCoordSeq(self.__p__._geom)
|
|
44
|
-
|
|
44
|
+
|
|
45
45
|
def __len__(self):
|
|
46
46
|
self._update()
|
|
47
47
|
cs_len = c_uint(0)
|
|
@@ -53,38 +53,56 @@ class CoordinateSequence(object):
|
|
|
53
53
|
dx = c_double()
|
|
54
54
|
dy = c_double()
|
|
55
55
|
dz = c_double()
|
|
56
|
-
|
|
56
|
+
has_z = self._ndim == 3
|
|
57
|
+
for i in xrange(self.__len__()):
|
|
57
58
|
lgeos.GEOSCoordSeq_getX(self._cseq, i, byref(dx))
|
|
58
59
|
lgeos.GEOSCoordSeq_getY(self._cseq, i, byref(dy))
|
|
59
|
-
if
|
|
60
|
+
if has_z:
|
|
60
61
|
lgeos.GEOSCoordSeq_getZ(self._cseq, i, byref(dz))
|
|
61
62
|
yield (dx.value, dy.value, dz.value)
|
|
62
63
|
else:
|
|
63
64
|
yield (dx.value, dy.value)
|
|
64
65
|
|
|
65
|
-
def __getitem__(self,
|
|
66
|
+
def __getitem__(self, key):
|
|
66
67
|
self._update()
|
|
67
|
-
M = self.__len__()
|
|
68
|
-
if i + M < 0 or i >= M:
|
|
69
|
-
raise IndexError("index out of range")
|
|
70
|
-
if i < 0:
|
|
71
|
-
ii = M + i
|
|
72
|
-
else:
|
|
73
|
-
ii = i
|
|
74
68
|
dx = c_double()
|
|
75
69
|
dy = c_double()
|
|
76
70
|
dz = c_double()
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if
|
|
80
|
-
|
|
81
|
-
|
|
71
|
+
m = self.__len__()
|
|
72
|
+
has_z = self._ndim == 3
|
|
73
|
+
if isinstance(key, int):
|
|
74
|
+
if key + m < 0 or key >= m:
|
|
75
|
+
raise IndexError("index out of range")
|
|
76
|
+
if key < 0:
|
|
77
|
+
i = m + key
|
|
78
|
+
else:
|
|
79
|
+
i = key
|
|
80
|
+
lgeos.GEOSCoordSeq_getX(self._cseq, i, byref(dx))
|
|
81
|
+
lgeos.GEOSCoordSeq_getY(self._cseq, i, byref(dy))
|
|
82
|
+
if has_z:
|
|
83
|
+
lgeos.GEOSCoordSeq_getZ(self._cseq, i, byref(dz))
|
|
84
|
+
return (dx.value, dy.value, dz.value)
|
|
85
|
+
else:
|
|
86
|
+
return (dx.value, dy.value)
|
|
87
|
+
elif isinstance(key, slice):
|
|
88
|
+
res = []
|
|
89
|
+
start, stop, stride = key.indices(m)
|
|
90
|
+
for i in xrange(start, stop, stride):
|
|
91
|
+
lgeos.GEOSCoordSeq_getX(self._cseq, i, byref(dx))
|
|
92
|
+
lgeos.GEOSCoordSeq_getY(self._cseq, i, byref(dy))
|
|
93
|
+
if has_z:
|
|
94
|
+
lgeos.GEOSCoordSeq_getZ(self._cseq, i, byref(dz))
|
|
95
|
+
res.append((dx.value, dy.value, dz.value))
|
|
96
|
+
else:
|
|
97
|
+
res.append((dx.value, dy.value))
|
|
98
|
+
return res
|
|
82
99
|
else:
|
|
83
|
-
|
|
100
|
+
raise TypeError("key must be an index or slice")
|
|
84
101
|
|
|
85
102
|
@property
|
|
86
103
|
def ctypes(self):
|
|
87
104
|
self._update()
|
|
105
|
+
has_z = self._ndim == 3
|
|
88
106
|
n = self._ndim
|
|
89
107
|
m = self.__len__()
|
|
90
108
|
array_type = c_double * (m * n)
|
|
@@ -95,7 +113,7 @@ class CoordinateSequence(object):
|
|
|
95
113
|
data[n*i] = temp.value
|
|
96
114
|
lgeos.GEOSCoordSeq_getY(self._cseq, i, byref(temp))
|
|
97
115
|
data[n*i+1] = temp.value
|
|
98
|
-
if
|
|
116
|
+
if has_z:
|
|
99
117
|
lgeos.GEOSCoordSeq_getZ(self._cseq, i, byref(temp))
|
|
100
118
|
data[n*i+2] = temp.value
|
|
101
119
|
return data
|
|
@@ -133,7 +151,7 @@ class CoordinateSequence(object):
|
|
|
133
151
|
lgeos.GEOSCoordSeq_getY(self._cseq, i, byref(temp))
|
|
134
152
|
y.append(temp.value)
|
|
135
153
|
return x, y
|
|
136
|
-
|
|
154
|
+
|
|
137
155
|
|
|
138
156
|
class BoundsOp(Validating):
|
|
139
157
|
|
|
@@ -163,4 +181,3 @@ class BoundsOp(Validating):
|
|
|
163
181
|
if y < miny: miny = y
|
|
164
182
|
if y > maxy: maxy = y
|
|
165
183
|
return (minx, miny, maxx, maxy)
|
|
166
|
-
|
shapely/coords.pyc
CHANGED
|
Binary file
|
shapely/geometry/base.py
CHANGED
|
@@ -12,13 +12,13 @@ from shapely import wkb, wkt
|
|
|
12
12
|
|
|
13
13
|
GEOMETRY_TYPES = [
|
|
14
14
|
'Point',
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
'LineString',
|
|
16
|
+
'LinearRing',
|
|
17
|
+
'Polygon',
|
|
18
|
+
'MultiPoint',
|
|
19
|
+
'MultiLineString',
|
|
20
|
+
'MultiPolygon',
|
|
21
|
+
'GeometryCollection'
|
|
22
22
|
]
|
|
23
23
|
|
|
24
24
|
def geometry_type_name(g):
|
|
@@ -548,23 +548,35 @@ class GeometrySequence(object):
|
|
|
548
548
|
|
|
549
549
|
def __iter__(self):
|
|
550
550
|
self._update()
|
|
551
|
-
for i in
|
|
551
|
+
for i in xrange(self.__len__()):
|
|
552
552
|
yield self._get_geom_item(i)
|
|
553
553
|
|
|
554
554
|
def __len__(self):
|
|
555
555
|
self._update()
|
|
556
556
|
return lgeos.GEOSGetNumGeometries(self._geom)
|
|
557
557
|
|
|
558
|
-
def __getitem__(self,
|
|
558
|
+
def __getitem__(self, key):
|
|
559
559
|
self._update()
|
|
560
|
-
|
|
561
|
-
if
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
560
|
+
m = self.__len__()
|
|
561
|
+
if isinstance(key, int):
|
|
562
|
+
if key + m < 0 or key >= m:
|
|
563
|
+
raise IndexError("index out of range")
|
|
564
|
+
if key < 0:
|
|
565
|
+
i = m + key
|
|
566
|
+
else:
|
|
567
|
+
i = key
|
|
568
|
+
return self._get_geom_item(i)
|
|
569
|
+
elif isinstance(key, slice):
|
|
570
|
+
if type(self) == HeterogeneousGeometrySequence:
|
|
571
|
+
raise TypeError(
|
|
572
|
+
"Heterogenous geometry collections are not sliceable")
|
|
573
|
+
res = []
|
|
574
|
+
start, stop, stride = key.indices(m)
|
|
575
|
+
for i in xrange(start, stop, stride):
|
|
576
|
+
res.append(self._get_geom_item(i))
|
|
577
|
+
return type(self.__p__)(res or None)
|
|
565
578
|
else:
|
|
566
|
-
|
|
567
|
-
return self._get_geom_item(i)
|
|
579
|
+
raise TypeError("key must be an index or slice")
|
|
568
580
|
|
|
569
581
|
@property
|
|
570
582
|
def _longest(self):
|
shapely/geometry/base.pyc
CHANGED
|
Binary file
|
|
@@ -41,7 +41,7 @@ class MultiLineString(BaseMultipartGeometry):
|
|
|
41
41
|
super(MultiLineString, self).__init__()
|
|
42
42
|
|
|
43
43
|
if lines is None:
|
|
44
|
-
# allow creation of
|
|
44
|
+
# allow creation of empty multilinestrings, to support unpickling
|
|
45
45
|
pass
|
|
46
46
|
else:
|
|
47
47
|
self._geom, self._ndim = geos_multilinestring_from_py(lines)
|
|
Binary file
|
shapely/geometry/multipolygon.py
CHANGED
|
@@ -51,7 +51,7 @@ class MultiPolygon(BaseMultipartGeometry):
|
|
|
51
51
|
super(MultiPolygon, self).__init__()
|
|
52
52
|
|
|
53
53
|
if polygons is None:
|
|
54
|
-
# allow creation of
|
|
54
|
+
# allow creation of empty multipolygons, to support unpickling
|
|
55
55
|
pass
|
|
56
56
|
elif context_type == 'polygons':
|
|
57
57
|
self._geom, self._ndim = geos_multipolygon_from_polygons(polygons)
|
|
Binary file
|
shapely/geometry/polygon.py
CHANGED
|
@@ -124,15 +124,24 @@ class InteriorRingSequence(object):
|
|
|
124
124
|
def __len__(self):
|
|
125
125
|
return lgeos.GEOSGetNumInteriorRings(self._geom)
|
|
126
126
|
|
|
127
|
-
def __getitem__(self,
|
|
128
|
-
|
|
129
|
-
if
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
127
|
+
def __getitem__(self, key):
|
|
128
|
+
m = self.__len__()
|
|
129
|
+
if isinstance(key, int):
|
|
130
|
+
if key + m < 0 or key >= m:
|
|
131
|
+
raise IndexError("index out of range")
|
|
132
|
+
if key < 0:
|
|
133
|
+
i = m + key
|
|
134
|
+
else:
|
|
135
|
+
i = key
|
|
136
|
+
return self._get_ring(i)
|
|
137
|
+
elif isinstance(key, slice):
|
|
138
|
+
res = []
|
|
139
|
+
start, stop, stride = key.indices(m)
|
|
140
|
+
for i in xrange(start, stop, stride):
|
|
141
|
+
res.append(self._get_ring(i))
|
|
142
|
+
return res
|
|
133
143
|
else:
|
|
134
|
-
|
|
135
|
-
return self._get_ring(i)
|
|
144
|
+
raise TypeError("key must be an index or slice")
|
|
136
145
|
|
|
137
146
|
@property
|
|
138
147
|
def _longest(self):
|
shapely/geometry/polygon.pyc
CHANGED
|
Binary file
|
shapely/speedups/_speedups.pyc
CHANGED
|
Binary file
|
shapely/speedups/_speedups.pyd
CHANGED
|
Binary file
|
shapely/tests/__init__.py
CHANGED
|
@@ -3,7 +3,7 @@ from unittest import TestSuite
|
|
|
3
3
|
import test_doctests, test_prepared, test_equality, test_geomseq, test_xy
|
|
4
4
|
import test_collection, test_emptiness, test_singularity, test_validation
|
|
5
5
|
import test_mapping, test_delegated, test_dlls, test_linear_referencing
|
|
6
|
-
import test_products_z, test_box, test_speedups, test_cga
|
|
6
|
+
import test_products_z, test_box, test_speedups, test_cga, test_getitem
|
|
7
7
|
|
|
8
8
|
def test_suite():
|
|
9
9
|
suite = TestSuite()
|
|
@@ -24,5 +24,6 @@ def test_suite():
|
|
|
24
24
|
suite.addTest(test_box.test_suite())
|
|
25
25
|
suite.addTest(test_speedups.test_suite())
|
|
26
26
|
suite.addTest(test_cga.test_suite())
|
|
27
|
+
suite.addTest(test_getitem.test_suite())
|
|
27
28
|
return suite
|
|
28
29
|
|
shapely/tests/__init__.pyc
CHANGED
|
Binary file
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
from shapely import geometry
|
|
3
|
+
|
|
4
|
+
class CoordsGetItemTestCase(unittest.TestCase):
|
|
5
|
+
def test_index_2d_coords(self):
|
|
6
|
+
c = [(float(x), float(-x)) for x in range(4)]
|
|
7
|
+
g = geometry.LineString(c)
|
|
8
|
+
for i in range(-4,4):
|
|
9
|
+
self.assertTrue(g.coords[i] == c[i])
|
|
10
|
+
self.assertRaises(IndexError, lambda: g.coords[4])
|
|
11
|
+
self.assertRaises(IndexError, lambda: g.coords[-5])
|
|
12
|
+
|
|
13
|
+
def test_index_3d_coords(self):
|
|
14
|
+
c = [(float(x), float(-x), float(x*2)) for x in range(4)]
|
|
15
|
+
g = geometry.LineString(c)
|
|
16
|
+
for i in range(-4,4):
|
|
17
|
+
self.assertTrue(g.coords[i] == c[i])
|
|
18
|
+
self.assertRaises(IndexError, lambda: g.coords[4])
|
|
19
|
+
self.assertRaises(IndexError, lambda: g.coords[-5])
|
|
20
|
+
|
|
21
|
+
def test_index_coords_misc(self):
|
|
22
|
+
g = geometry.LineString() # empty
|
|
23
|
+
self.assertRaises(IndexError, lambda: g.coords[0])
|
|
24
|
+
self.assertRaises(TypeError, lambda: g.coords[0.0])
|
|
25
|
+
|
|
26
|
+
def test_slice_2d_coords(self):
|
|
27
|
+
c = [(float(x), float(-x)) for x in range(4)]
|
|
28
|
+
g = geometry.LineString(c)
|
|
29
|
+
self.assertTrue(g.coords[1:] == c[1:])
|
|
30
|
+
self.assertTrue(g.coords[:-1] == c[:-1])
|
|
31
|
+
self.assertTrue(g.coords[::-1] == c[::-1])
|
|
32
|
+
self.assertTrue(g.coords[::2] == c[::2])
|
|
33
|
+
self.assertTrue(g.coords[:4] == c[:4])
|
|
34
|
+
self.assertTrue(g.coords[4:] == c[4:] == [])
|
|
35
|
+
|
|
36
|
+
def test_slice_3d_coords(self):
|
|
37
|
+
c = [(float(x), float(-x), float(x*2)) for x in range(4)]
|
|
38
|
+
g = geometry.LineString(c)
|
|
39
|
+
self.assertTrue(g.coords[1:] == c[1:])
|
|
40
|
+
self.assertTrue(g.coords[:-1] == c[:-1])
|
|
41
|
+
self.assertTrue(g.coords[::-1] == c[::-1])
|
|
42
|
+
self.assertTrue(g.coords[::2] == c[::2])
|
|
43
|
+
self.assertTrue(g.coords[:4] == c[:4])
|
|
44
|
+
self.assertTrue(g.coords[4:] == c[4:] == [])
|
|
45
|
+
|
|
46
|
+
class MultiGeomGetItemTestCase(unittest.TestCase):
|
|
47
|
+
def test_index_multigeom(self):
|
|
48
|
+
c = [(float(x), float(-x)) for x in range(4)]
|
|
49
|
+
g = geometry.MultiPoint(c)
|
|
50
|
+
for i in range(-4,4):
|
|
51
|
+
self.assertTrue(g[i].equals(geometry.Point(c[i])))
|
|
52
|
+
self.assertRaises(IndexError, lambda: g[4])
|
|
53
|
+
self.assertRaises(IndexError, lambda: g[-5])
|
|
54
|
+
|
|
55
|
+
def test_index_multigeom_misc(self):
|
|
56
|
+
g = geometry.MultiLineString() # empty
|
|
57
|
+
self.assertRaises(IndexError, lambda: g[0])
|
|
58
|
+
self.assertRaises(TypeError, lambda: g[0.0])
|
|
59
|
+
|
|
60
|
+
def test_slice_multigeom(self):
|
|
61
|
+
c = [(float(x), float(-x)) for x in range(4)]
|
|
62
|
+
g = geometry.MultiPoint(c)
|
|
63
|
+
self.failUnlessEqual(type(g[:]), type(g))
|
|
64
|
+
self.failUnlessEqual(len(g[:]), len(g))
|
|
65
|
+
self.failUnless(g[1:].equals(geometry.MultiPoint(c[1:])))
|
|
66
|
+
self.failUnless(g[:-1].equals(geometry.MultiPoint(c[:-1])))
|
|
67
|
+
self.failUnless(g[::-1].equals(geometry.MultiPoint(c[::-1])))
|
|
68
|
+
self.failUnless(g[4:].is_empty)
|
|
69
|
+
|
|
70
|
+
class LinearRingGetItemTestCase(unittest.TestCase):
|
|
71
|
+
def test_index_linearring(self):
|
|
72
|
+
shell = geometry.polygon.LinearRing([(0.0, 0.0), (70.0, 120.0),
|
|
73
|
+
(140.0, 0.0), (0.0, 0.0)])
|
|
74
|
+
holes = [geometry.polygon.LinearRing([(60.0, 80.0), (80.0, 80.0),
|
|
75
|
+
(70.0, 60.0), (60.0, 80.0)]),
|
|
76
|
+
geometry.polygon.LinearRing([(30.0, 10.0), (50.0, 10.0),
|
|
77
|
+
(40.0, 30.0), (30.0, 10.0)]),
|
|
78
|
+
geometry.polygon.LinearRing([(90.0, 10), (110.0, 10.0),
|
|
79
|
+
(100.0, 30.0), (90.0, 10.0)])]
|
|
80
|
+
g = geometry.Polygon(shell, holes)
|
|
81
|
+
for i in range(-3,3):
|
|
82
|
+
self.assertTrue(g.interiors[i].equals(holes[i]))
|
|
83
|
+
self.assertRaises(IndexError, lambda: g.interiors[3])
|
|
84
|
+
self.assertRaises(IndexError, lambda: g.interiors[-4])
|
|
85
|
+
|
|
86
|
+
def test_index_linearring_misc(self):
|
|
87
|
+
g = geometry.Polygon() # empty
|
|
88
|
+
self.assertRaises(IndexError, lambda: g.interiors[0])
|
|
89
|
+
self.assertRaises(TypeError, lambda: g.interiors[0.0])
|
|
90
|
+
|
|
91
|
+
def test_slice_linearring(self):
|
|
92
|
+
shell = geometry.polygon.LinearRing([(0.0, 0.0), (70.0, 120.0),
|
|
93
|
+
(140.0, 0.0), (0.0, 0.0)])
|
|
94
|
+
holes = [geometry.polygon.LinearRing([(60.0, 80.0), (80.0, 80.0),
|
|
95
|
+
(70.0, 60.0), (60.0, 80.0)]),
|
|
96
|
+
geometry.polygon.LinearRing([(30.0, 10.0), (50.0, 10.0),
|
|
97
|
+
(40.0, 30.0), (30.0, 10.0)]),
|
|
98
|
+
geometry.polygon.LinearRing([(90.0, 10), (110.0, 10.0),
|
|
99
|
+
(100.0, 30.0), (90.0, 10.0)])]
|
|
100
|
+
g = geometry.Polygon(shell, holes)
|
|
101
|
+
self.assertTrue(all([a.equals(b) for (a, b) in zip(g.interiors[1:], holes[1:])]))
|
|
102
|
+
self.assertTrue(all([a.equals(b) for (a, b) in zip(g.interiors[:-1], holes[:-1])]))
|
|
103
|
+
self.assertTrue(all([a.equals(b) for (a, b) in zip(g.interiors[::-1], holes[::-1])]))
|
|
104
|
+
self.assertTrue(all([a.equals(b) for (a, b) in zip(g.interiors[::2], holes[::2])]))
|
|
105
|
+
self.assertTrue(all([a.equals(b) for (a, b) in zip(g.interiors[:3], holes[:3])]))
|
|
106
|
+
self.assertTrue(g.interiors[3:] == holes[3:] == [])
|
|
107
|
+
|
|
108
|
+
def test_suite():
|
|
109
|
+
loader = unittest.TestLoader()
|
|
110
|
+
return unittest.TestSuite([
|
|
111
|
+
unittest.TestLoader().loadTestsFromTestCase(CoordsGetItemTestCase),
|
|
112
|
+
unittest.TestLoader().loadTestsFromTestCase(MultiGeomGetItemTestCase),
|
|
113
|
+
unittest.TestLoader().loadTestsFromTestCase(LinearRingGetItemTestCase)])
|
|
Binary file
|