shapely 1.2.13__tar.gz → 1.2.14__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.2.13 → Shapely-1.2.14}/CHANGES.txt +10 -4
- {Shapely-1.2.13 → Shapely-1.2.14}/CREDITS.txt +1 -0
- {Shapely-1.2.13/Shapely.egg-info → Shapely-1.2.14}/PKG-INFO +25 -21
- {Shapely-1.2.13 → Shapely-1.2.14}/README.rst +14 -15
- {Shapely-1.2.13 → Shapely-1.2.14/Shapely.egg-info}/PKG-INFO +25 -21
- {Shapely-1.2.13 → Shapely-1.2.14}/Shapely.egg-info/SOURCES.txt +1 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/docs/manual.txt +41 -10
- {Shapely-1.2.13 → Shapely-1.2.14}/setup.py +7 -3
- Shapely-1.2.14/shapely/__init__.py +2 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/coords.py +38 -21
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/geometry/base.py +28 -16
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/geometry/multilinestring.py +1 -1
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/geometry/multipolygon.py +1 -1
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/geometry/polygon.py +17 -8
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/MultiPolygon.txt +8 -8
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/Point.txt +2 -2
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/Polygon.txt +3 -3
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/__init__.py +2 -1
- Shapely-1.2.14/shapely/tests/test_getitem.py +113 -0
- Shapely-1.2.13/shapely/__init__.py +0 -2
- {Shapely-1.2.13 → Shapely-1.2.14}/LICENSE.txt +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/Shapely.egg-info/dependency_links.txt +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/Shapely.egg-info/top_level.txt +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/setup.cfg +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/algorithms/__init__.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/algorithms/cga.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/ctypes_declarations.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/examples/__init__.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/examples/dissolve.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/examples/geoms.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/examples/intersect.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/examples/world.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/ftools.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/geometry/__init__.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/geometry/collection.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/geometry/geo.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/geometry/linestring.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/geometry/multipoint.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/geometry/point.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/geometry/proxy.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/geos.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/impl.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/iterops.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/linref.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/ops.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/predicates.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/prepared.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/speedups/__init__.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/speedups/_speedups.c +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/speedups/_speedups.pyx +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/Array.txt +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/GeoInterface.txt +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/IterOps.txt +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/LineString.txt +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/MultiLineString.txt +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/MultiPoint.txt +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/Operations.txt +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/Persist.txt +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/Predicates.txt +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/attribute-chains.txt +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/binascii_hex.txt +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/cascaded_union.txt +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/dimensions.txt +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/invalid_intersection.txt +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/linemerge.txt +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/polygonize.txt +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/test_box.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/test_cga.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/test_collection.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/test_delegated.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/test_dlls.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/test_doctests.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/test_emptiness.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/test_equality.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/test_geomseq.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/test_linear_referencing.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/test_mapping.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/test_prepared.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/test_products_z.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/test_singularity.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/test_speedups.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/test_validation.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/test_xy.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/threading_test.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/tests/wkt_locale.txt +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/topology.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/validation.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/wkb.py +0 -0
- {Shapely-1.2.13 → Shapely-1.2.14}/shapely/wkt.py +0 -0
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
=======
|
|
2
|
-
|
|
2
|
+
Changes
|
|
3
3
|
=======
|
|
4
4
|
|
|
5
|
+
1.2.14 (2012-01-23)
|
|
6
|
+
-------------------
|
|
7
|
+
- A geometry's coords property is now sliceable, yielding a list of coordinate
|
|
8
|
+
values.
|
|
9
|
+
- Homogeneous collections are now sliceable, yielding a new collection of the
|
|
10
|
+
same type.
|
|
11
|
+
|
|
5
12
|
1.2.13 (2011-09-16)
|
|
6
13
|
-------------------
|
|
7
|
-
- Fixed errors in speedups on 32bit systems when GEOS references memory above
|
|
14
|
+
- Fixed errors in speedups on 32bit systems when GEOS references memory above
|
|
15
|
+
2GB.
|
|
8
16
|
- Add shapely.__version__ attribute.
|
|
9
17
|
- Update the manual.
|
|
10
18
|
|
|
@@ -139,9 +147,7 @@ TODO: fill gap here
|
|
|
139
147
|
- Prototype libgeos_c functions in a way that lets py2exe apps import shapely
|
|
140
148
|
(#189).
|
|
141
149
|
|
|
142
|
-
=========================
|
|
143
150
|
1.2 Branched (2009-09-19)
|
|
144
|
-
=========================
|
|
145
151
|
|
|
146
152
|
1.0.12 (2009-04-09)
|
|
147
153
|
-------------------
|
|
@@ -1,16 +1,17 @@
|
|
|
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
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
|
-
|
|
11
|
-
|
|
9
|
+
Description: ======
|
|
10
|
+
README
|
|
11
|
+
======
|
|
12
12
|
|
|
13
|
-
PostGIS-ish operations outside a database context for Pythoneers and
|
|
13
|
+
PostGIS-ish operations outside a database context for Pythoneers and
|
|
14
|
+
Pythonistas.
|
|
14
15
|
|
|
15
16
|
.. image:: http://farm3.static.flickr.com/2738/4511827859_b5822043b7_o_d.png
|
|
16
17
|
:width: 800
|
|
@@ -107,7 +108,7 @@ Description: =======
|
|
|
107
108
|
Testing
|
|
108
109
|
=======
|
|
109
110
|
|
|
110
|
-
Shapely uses a Zope-stye suite of unittests and doctests,
|
|
111
|
+
Shapely uses a Zope-stye suite of unittests and doctests, exercised via
|
|
111
112
|
setup.py.::
|
|
112
113
|
|
|
113
114
|
$ python setup.py test
|
|
@@ -118,7 +119,7 @@ Description: =======
|
|
|
118
119
|
Support
|
|
119
120
|
=======
|
|
120
121
|
|
|
121
|
-
Bugs may be reported and questions asked via https://github.com/
|
|
122
|
+
Bugs may be reported and questions asked via https://github.com/Toblerity/Shapely.
|
|
122
123
|
|
|
123
124
|
Credits
|
|
124
125
|
=======
|
|
@@ -128,22 +129,23 @@ Description: =======
|
|
|
128
129
|
* Sean Gillies
|
|
129
130
|
* Aron Bierbaum
|
|
130
131
|
* Kai Lautaportti
|
|
132
|
+
* Oliver Tonnhofer
|
|
131
133
|
|
|
132
134
|
Patches contributed by:
|
|
133
135
|
|
|
134
136
|
* Howard Butler
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
+
* Frédéric Junod
|
|
138
|
+
* Éric Lemoine
|
|
137
139
|
* Jonathan Tartley
|
|
138
140
|
* Kristian Thy
|
|
139
|
-
*
|
|
141
|
+
* Mike Toews (https://github.com/mwtoews)
|
|
140
142
|
|
|
141
143
|
Additional help from:
|
|
142
144
|
|
|
143
145
|
* Justin Bronn (GeoDjango) for ctypes inspiration
|
|
144
146
|
* Martin Davis (JTS)
|
|
145
147
|
* Jaakko Salli for the Windows distributions
|
|
146
|
-
* Sandro Santilli, Mateusz Loskot, Paul Ramsey, et al (
|
|
148
|
+
* Sandro Santilli, Mateusz Loskot, Paul Ramsey, et al (GEOS_ Project)
|
|
147
149
|
|
|
148
150
|
Major portions of this work were supported by a grant (for Pleiades_) from the
|
|
149
151
|
U.S. National Endowment for the Humanities (http://www.neh.gov).
|
|
@@ -153,20 +155,24 @@ Description: =======
|
|
|
153
155
|
.. _GEOS: http://trac.osgeo.org/geos/
|
|
154
156
|
.. _example apps: http://trac.gispython.org/lab/wiki/Examples
|
|
155
157
|
.. _wiki: http://trac.gispython.org/lab/wiki/Shapely
|
|
156
|
-
.. _manual: http://
|
|
157
|
-
.. |eacute| unicode:: U+00E9
|
|
158
|
-
:trim:
|
|
159
|
-
.. |Eacute| unicode:: U+00C9
|
|
160
|
-
:trim:
|
|
158
|
+
.. _manual: http://toblerity.github.com/shapely/manual.html
|
|
161
159
|
.. _Pleiades: http://pleiades.stoa.org
|
|
162
160
|
|
|
161
|
+
|
|
162
|
+
Changes
|
|
163
163
|
=======
|
|
164
|
-
|
|
165
|
-
|
|
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.
|
|
166
171
|
|
|
167
172
|
1.2.13 (2011-09-16)
|
|
168
173
|
-------------------
|
|
169
|
-
- Fixed errors in speedups on 32bit systems when GEOS references memory above
|
|
174
|
+
- Fixed errors in speedups on 32bit systems when GEOS references memory above
|
|
175
|
+
2GB.
|
|
170
176
|
- Add shapely.__version__ attribute.
|
|
171
177
|
- Update the manual.
|
|
172
178
|
|
|
@@ -301,9 +307,7 @@ Description: =======
|
|
|
301
307
|
- Prototype libgeos_c functions in a way that lets py2exe apps import shapely
|
|
302
308
|
(#189).
|
|
303
309
|
|
|
304
|
-
=========================
|
|
305
310
|
1.2 Branched (2009-09-19)
|
|
306
|
-
=========================
|
|
307
311
|
|
|
308
312
|
1.0.12 (2009-04-09)
|
|
309
313
|
-------------------
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
======
|
|
2
|
+
README
|
|
3
|
+
======
|
|
4
4
|
|
|
5
|
-
PostGIS-ish operations outside a database context for Pythoneers and
|
|
5
|
+
PostGIS-ish operations outside a database context for Pythoneers and
|
|
6
|
+
Pythonistas.
|
|
6
7
|
|
|
7
8
|
.. image:: http://farm3.static.flickr.com/2738/4511827859_b5822043b7_o_d.png
|
|
8
9
|
:width: 800
|
|
@@ -99,7 +100,7 @@ Numpy arrays can also be adapted to Shapely linestrings::
|
|
|
99
100
|
Testing
|
|
100
101
|
=======
|
|
101
102
|
|
|
102
|
-
Shapely uses a Zope-stye suite of unittests and doctests,
|
|
103
|
+
Shapely uses a Zope-stye suite of unittests and doctests, exercised via
|
|
103
104
|
setup.py.::
|
|
104
105
|
|
|
105
106
|
$ python setup.py test
|
|
@@ -110,7 +111,7 @@ supported well by nose.
|
|
|
110
111
|
Support
|
|
111
112
|
=======
|
|
112
113
|
|
|
113
|
-
Bugs may be reported and questions asked via https://github.com/
|
|
114
|
+
Bugs may be reported and questions asked via https://github.com/Toblerity/Shapely.
|
|
114
115
|
|
|
115
116
|
Credits
|
|
116
117
|
=======
|
|
@@ -120,22 +121,23 @@ Shapely is written by:
|
|
|
120
121
|
* Sean Gillies
|
|
121
122
|
* Aron Bierbaum
|
|
122
123
|
* Kai Lautaportti
|
|
124
|
+
* Oliver Tonnhofer
|
|
123
125
|
|
|
124
126
|
Patches contributed by:
|
|
125
127
|
|
|
126
128
|
* Howard Butler
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
+
* Frédéric Junod
|
|
130
|
+
* Éric Lemoine
|
|
129
131
|
* Jonathan Tartley
|
|
130
132
|
* Kristian Thy
|
|
131
|
-
*
|
|
133
|
+
* Mike Toews (https://github.com/mwtoews)
|
|
132
134
|
|
|
133
135
|
Additional help from:
|
|
134
136
|
|
|
135
137
|
* Justin Bronn (GeoDjango) for ctypes inspiration
|
|
136
138
|
* Martin Davis (JTS)
|
|
137
139
|
* Jaakko Salli for the Windows distributions
|
|
138
|
-
* Sandro Santilli, Mateusz Loskot, Paul Ramsey, et al (
|
|
140
|
+
* Sandro Santilli, Mateusz Loskot, Paul Ramsey, et al (GEOS_ Project)
|
|
139
141
|
|
|
140
142
|
Major portions of this work were supported by a grant (for Pleiades_) from the
|
|
141
143
|
U.S. National Endowment for the Humanities (http://www.neh.gov).
|
|
@@ -145,9 +147,6 @@ U.S. National Endowment for the Humanities (http://www.neh.gov).
|
|
|
145
147
|
.. _GEOS: http://trac.osgeo.org/geos/
|
|
146
148
|
.. _example apps: http://trac.gispython.org/lab/wiki/Examples
|
|
147
149
|
.. _wiki: http://trac.gispython.org/lab/wiki/Shapely
|
|
148
|
-
.. _manual: http://
|
|
149
|
-
.. |eacute| unicode:: U+00E9
|
|
150
|
-
:trim:
|
|
151
|
-
.. |Eacute| unicode:: U+00C9
|
|
152
|
-
:trim:
|
|
150
|
+
.. _manual: http://toblerity.github.com/shapely/manual.html
|
|
153
151
|
.. _Pleiades: http://pleiades.stoa.org
|
|
152
|
+
|
|
@@ -1,16 +1,17 @@
|
|
|
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
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
|
-
|
|
11
|
-
|
|
9
|
+
Description: ======
|
|
10
|
+
README
|
|
11
|
+
======
|
|
12
12
|
|
|
13
|
-
PostGIS-ish operations outside a database context for Pythoneers and
|
|
13
|
+
PostGIS-ish operations outside a database context for Pythoneers and
|
|
14
|
+
Pythonistas.
|
|
14
15
|
|
|
15
16
|
.. image:: http://farm3.static.flickr.com/2738/4511827859_b5822043b7_o_d.png
|
|
16
17
|
:width: 800
|
|
@@ -107,7 +108,7 @@ Description: =======
|
|
|
107
108
|
Testing
|
|
108
109
|
=======
|
|
109
110
|
|
|
110
|
-
Shapely uses a Zope-stye suite of unittests and doctests,
|
|
111
|
+
Shapely uses a Zope-stye suite of unittests and doctests, exercised via
|
|
111
112
|
setup.py.::
|
|
112
113
|
|
|
113
114
|
$ python setup.py test
|
|
@@ -118,7 +119,7 @@ Description: =======
|
|
|
118
119
|
Support
|
|
119
120
|
=======
|
|
120
121
|
|
|
121
|
-
Bugs may be reported and questions asked via https://github.com/
|
|
122
|
+
Bugs may be reported and questions asked via https://github.com/Toblerity/Shapely.
|
|
122
123
|
|
|
123
124
|
Credits
|
|
124
125
|
=======
|
|
@@ -128,22 +129,23 @@ Description: =======
|
|
|
128
129
|
* Sean Gillies
|
|
129
130
|
* Aron Bierbaum
|
|
130
131
|
* Kai Lautaportti
|
|
132
|
+
* Oliver Tonnhofer
|
|
131
133
|
|
|
132
134
|
Patches contributed by:
|
|
133
135
|
|
|
134
136
|
* Howard Butler
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
+
* Frédéric Junod
|
|
138
|
+
* Éric Lemoine
|
|
137
139
|
* Jonathan Tartley
|
|
138
140
|
* Kristian Thy
|
|
139
|
-
*
|
|
141
|
+
* Mike Toews (https://github.com/mwtoews)
|
|
140
142
|
|
|
141
143
|
Additional help from:
|
|
142
144
|
|
|
143
145
|
* Justin Bronn (GeoDjango) for ctypes inspiration
|
|
144
146
|
* Martin Davis (JTS)
|
|
145
147
|
* Jaakko Salli for the Windows distributions
|
|
146
|
-
* Sandro Santilli, Mateusz Loskot, Paul Ramsey, et al (
|
|
148
|
+
* Sandro Santilli, Mateusz Loskot, Paul Ramsey, et al (GEOS_ Project)
|
|
147
149
|
|
|
148
150
|
Major portions of this work were supported by a grant (for Pleiades_) from the
|
|
149
151
|
U.S. National Endowment for the Humanities (http://www.neh.gov).
|
|
@@ -153,20 +155,24 @@ Description: =======
|
|
|
153
155
|
.. _GEOS: http://trac.osgeo.org/geos/
|
|
154
156
|
.. _example apps: http://trac.gispython.org/lab/wiki/Examples
|
|
155
157
|
.. _wiki: http://trac.gispython.org/lab/wiki/Shapely
|
|
156
|
-
.. _manual: http://
|
|
157
|
-
.. |eacute| unicode:: U+00E9
|
|
158
|
-
:trim:
|
|
159
|
-
.. |Eacute| unicode:: U+00C9
|
|
160
|
-
:trim:
|
|
158
|
+
.. _manual: http://toblerity.github.com/shapely/manual.html
|
|
161
159
|
.. _Pleiades: http://pleiades.stoa.org
|
|
162
160
|
|
|
161
|
+
|
|
162
|
+
Changes
|
|
163
163
|
=======
|
|
164
|
-
|
|
165
|
-
|
|
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.
|
|
166
171
|
|
|
167
172
|
1.2.13 (2011-09-16)
|
|
168
173
|
-------------------
|
|
169
|
-
- Fixed errors in speedups on 32bit systems when GEOS references memory above
|
|
174
|
+
- Fixed errors in speedups on 32bit systems when GEOS references memory above
|
|
175
|
+
2GB.
|
|
170
176
|
- Add shapely.__version__ attribute.
|
|
171
177
|
- Update the manual.
|
|
172
178
|
|
|
@@ -301,9 +307,7 @@ Description: =======
|
|
|
301
307
|
- Prototype libgeos_c functions in a way that lets py2exe apps import shapely
|
|
302
308
|
(#189).
|
|
303
309
|
|
|
304
|
-
=========================
|
|
305
310
|
1.2 Branched (2009-09-19)
|
|
306
|
-
=========================
|
|
307
311
|
|
|
308
312
|
1.0.12 (2009-04-09)
|
|
309
313
|
-------------------
|
|
@@ -74,6 +74,7 @@ shapely/tests/test_doctests.py
|
|
|
74
74
|
shapely/tests/test_emptiness.py
|
|
75
75
|
shapely/tests/test_equality.py
|
|
76
76
|
shapely/tests/test_geomseq.py
|
|
77
|
+
shapely/tests/test_getitem.py
|
|
77
78
|
shapely/tests/test_linear_referencing.py
|
|
78
79
|
shapely/tests/test_mapping.py
|
|
79
80
|
shapely/tests/test_prepared.py
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
.. _manual:
|
|
2
|
+
|
|
1
3
|
=======================
|
|
2
4
|
The Shapely User Manual
|
|
3
5
|
=======================
|
|
4
6
|
|
|
5
7
|
:Author: Sean Gillies, <sean.gillies@gmail.com>
|
|
6
|
-
:Revision: 1.2.
|
|
7
|
-
:Date:
|
|
8
|
+
:Revision: 1.2.14
|
|
9
|
+
:Date: 21 January 2012
|
|
8
10
|
:Copyright:
|
|
9
11
|
This work is licensed under a `Creative Commons Attribution 3.0
|
|
10
12
|
United States License`__.
|
|
@@ -15,8 +17,6 @@ The Shapely User Manual
|
|
|
15
17
|
This document explains how to use the Shapely Python package for
|
|
16
18
|
computational geometry.
|
|
17
19
|
|
|
18
|
-
.. sectnum::
|
|
19
|
-
|
|
20
20
|
.. _intro:
|
|
21
21
|
|
|
22
22
|
Introduction
|
|
@@ -267,6 +267,13 @@ Coordinate values are accessed via `coords`, `x`, `y`, and `z` properties.
|
|
|
267
267
|
>>> point.y
|
|
268
268
|
0.0
|
|
269
269
|
|
|
270
|
+
Coordinates may also be sliced. `New in version 1.2.14`.
|
|
271
|
+
|
|
272
|
+
.. sourcecode:: pycon
|
|
273
|
+
|
|
274
|
+
>>> point.coords[:]
|
|
275
|
+
[(0.0, 0.0)]
|
|
276
|
+
|
|
270
277
|
The `Point` constructor also accepts another `Point` instance, thereby making
|
|
271
278
|
a copy.
|
|
272
279
|
|
|
@@ -323,6 +330,15 @@ The defining coordinate values are accessed via the `coords` property.
|
|
|
323
330
|
>>> list(line.coords)
|
|
324
331
|
[(0.0, 0.0), (1.0, 1.0)]
|
|
325
332
|
|
|
333
|
+
Coordinates may also be sliced. `New in version 1.2.14`.
|
|
334
|
+
|
|
335
|
+
.. sourcecode:: pycon
|
|
336
|
+
|
|
337
|
+
>>> point.coords[:]
|
|
338
|
+
[(0.0, 0.0), (1.0, 1.0)]
|
|
339
|
+
>>> point.coords[1:]
|
|
340
|
+
[(1.0, 1.0)]
|
|
341
|
+
|
|
326
342
|
The constructor also accepts another `LineString` instance, thereby making a
|
|
327
343
|
copy.
|
|
328
344
|
|
|
@@ -509,12 +525,11 @@ To obtain a polygon with a known orientation, use
|
|
|
509
525
|
Collections
|
|
510
526
|
-----------
|
|
511
527
|
|
|
512
|
-
Shapely provides frozenset_-like, immutable collections of geometric objects.
|
|
513
|
-
The collections may be homogeneous (`MultiPoint` etc.) or heterogeneous.
|
|
514
|
-
|
|
515
528
|
Heterogeneous collections of geometric objects may result from some Shapely
|
|
516
529
|
operations. For example, two `LineStrings` may intersect along a line and at a
|
|
517
|
-
point.
|
|
530
|
+
point. To represent these kind of results, Shapely provides frozenset_-like,
|
|
531
|
+
immutable collections of geometric objects. The collections may be homogeneous
|
|
532
|
+
(`MultiPoint` etc.) or heterogeneous.
|
|
518
533
|
|
|
519
534
|
.. sourcecode:: python
|
|
520
535
|
|
|
@@ -547,6 +562,22 @@ the iterator protocol using ``in`` or ``list()``.
|
|
|
547
562
|
[<shapely.geometry.point.Point object at 0x...>,
|
|
548
563
|
<shapely.geometry.linestring.LineString object at 0x...>]
|
|
549
564
|
|
|
565
|
+
Homogeneous collections can also be sliced, resulting in a new object of the
|
|
566
|
+
same type.
|
|
567
|
+
|
|
568
|
+
.. sourcecode:: pycon
|
|
569
|
+
|
|
570
|
+
>>> from shapely.geometry import MultiPoint
|
|
571
|
+
>>> m = MultiPoint([(0, 0), (1, 1), (1,2), (2,2)])
|
|
572
|
+
>>> m[:1].wkt
|
|
573
|
+
'MULTIPOINT (0.0000000000000000 0.0000000000000000)'
|
|
574
|
+
>>> m[3:].wkt
|
|
575
|
+
'MULTIPOINT (2.0000000000000000 2.0000000000000000)'
|
|
576
|
+
>>> m[4:].wkt
|
|
577
|
+
'GEOMETRYCOLLECTION EMPTY'
|
|
578
|
+
|
|
579
|
+
`New in version 1.2.14`.
|
|
580
|
+
|
|
550
581
|
.. note::
|
|
551
582
|
|
|
552
583
|
When possible, it is better to use one of the homogeneous collection types
|
|
@@ -1824,7 +1855,7 @@ Conclusion
|
|
|
1824
1855
|
We hope that you will enjoy and profit from using Shapely. Questions and
|
|
1825
1856
|
comments are welcome on the GIS-Python email list_. This manual will be updated
|
|
1826
1857
|
and improved regularly. Its source is available at
|
|
1827
|
-
http://github.com/
|
|
1858
|
+
http://github.com/Toblerity/Shapely/tree/master/docs/.
|
|
1828
1859
|
|
|
1829
1860
|
|
|
1830
1861
|
References
|
|
@@ -1857,7 +1888,7 @@ References
|
|
|
1857
1888
|
1973, pp. 112-122.
|
|
1858
1889
|
|
|
1859
1890
|
|
|
1860
|
-
.. _GEOS: http://
|
|
1891
|
+
.. _GEOS: http://trac.osgeo.org/geos/
|
|
1861
1892
|
.. _Java Topology Suite: http://www.vividsolutions.com/jts/jtshome.htm
|
|
1862
1893
|
.. _JTS: http://www.vividsolutions.com/jts/jtshome.htm
|
|
1863
1894
|
.. _PostGIS: http://postgis.refractions.net
|
|
@@ -17,13 +17,17 @@ from setuptools import setup, find_packages
|
|
|
17
17
|
import sys
|
|
18
18
|
import platform
|
|
19
19
|
|
|
20
|
-
readme_text =
|
|
21
|
-
|
|
20
|
+
readme_text = open('README.rst', 'rb').read()
|
|
21
|
+
|
|
22
|
+
# Skip the first line of the changes file to get the right header level
|
|
23
|
+
f = open('CHANGES.txt', 'rb')
|
|
24
|
+
f.readline()
|
|
25
|
+
changes_text = f.read()
|
|
22
26
|
|
|
23
27
|
setup_args = dict(
|
|
24
28
|
metadata_version = '1.2',
|
|
25
29
|
name = 'Shapely',
|
|
26
|
-
version = '1.2.
|
|
30
|
+
version = '1.2.14',
|
|
27
31
|
requires_python = '>=2.5,<3',
|
|
28
32
|
requires_external = 'libgeos_c (>=3.1)',
|
|
29
33
|
description = 'Geometric objects, predicates, and operations',
|
|
@@ -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
|
-
|
|
@@ -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):
|
|
@@ -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)
|
|
@@ -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)
|
|
@@ -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):
|
|
@@ -9,23 +9,23 @@ Initialization
|
|
|
9
9
|
From coordinate tuples
|
|
10
10
|
|
|
11
11
|
>>> geom = MultiPolygon( [
|
|
12
|
-
... (((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)), [((0.
|
|
12
|
+
... (((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)), [((0.25,0.25), (0.25,0.5), (0.5,0.5), (0.5,0.25))])
|
|
13
13
|
... ] )
|
|
14
14
|
>>> geom # doctest: +ELLIPSIS
|
|
15
15
|
<shapely.geometry.multipolygon.MultiPolygon object at ...>
|
|
16
16
|
>>> len(geom.geoms)
|
|
17
17
|
1
|
|
18
18
|
>>> geom.wkt
|
|
19
|
-
'MULTIPOLYGON (((0.0000000000000000 0.0000000000000000, 0.0000000000000000 1.0000000000000000, 1.0000000000000000 1.0000000000000000, 1.0000000000000000 0.0000000000000000, 0.0000000000000000 0.0000000000000000), (0.
|
|
19
|
+
'MULTIPOLYGON (((0.0000000000000000 0.0000000000000000, 0.0000000000000000 1.0000000000000000, 1.0000000000000000 1.0000000000000000, 1.0000000000000000 0.0000000000000000, 0.0000000000000000 0.0000000000000000), (0.2500000000000000 0.2500000000000000, 0.2500000000000000 0.5000000000000000, 0.5000000000000000 0.5000000000000000, 0.5000000000000000 0.2500000000000000, 0.2500000000000000 0.2500000000000000)))'
|
|
20
20
|
|
|
21
21
|
Or from polygons
|
|
22
22
|
|
|
23
|
-
>>> p = Polygon(((0, 0), (0, 1), (1, 1), (1, 0)), [((0.
|
|
23
|
+
>>> p = Polygon(((0, 0), (0, 1), (1, 1), (1, 0)), [((0.25,0.25), (0.25,0.5), (0.5,0.5), (0.5,0.25))])
|
|
24
24
|
>>> geom = MultiPolygon([p])
|
|
25
25
|
>>> len(geom.geoms)
|
|
26
26
|
1
|
|
27
27
|
>>> print geom.wkt
|
|
28
|
-
MULTIPOLYGON (((0.0000000000000000 0.0000000000000000, 0.0000000000000000 1.0000000000000000, 1.0000000000000000 1.0000000000000000, 1.0000000000000000 0.0000000000000000, 0.0000000000000000 0.0000000000000000), (0.
|
|
28
|
+
MULTIPOLYGON (((0.0000000000000000 0.0000000000000000, 0.0000000000000000 1.0000000000000000, 1.0000000000000000 1.0000000000000000, 1.0000000000000000 0.0000000000000000, 0.0000000000000000 0.0000000000000000), (0.2500000000000000 0.2500000000000000, 0.2500000000000000 0.5000000000000000, 0.5000000000000000 0.5000000000000000, 0.5000000000000000 0.2500000000000000, 0.2500000000000000 0.2500000000000000)))
|
|
29
29
|
|
|
30
30
|
Or from another multi-polygon
|
|
31
31
|
|
|
@@ -33,7 +33,7 @@ Or from another multi-polygon
|
|
|
33
33
|
>>> len(geom2.geoms)
|
|
34
34
|
1
|
|
35
35
|
>>> print geom2.wkt
|
|
36
|
-
MULTIPOLYGON (((0.0000000000000000 0.0000000000000000, 0.0000000000000000 1.0000000000000000, 1.0000000000000000 1.0000000000000000, 1.0000000000000000 0.0000000000000000, 0.0000000000000000 0.0000000000000000), (0.
|
|
36
|
+
MULTIPOLYGON (((0.0000000000000000 0.0000000000000000, 0.0000000000000000 1.0000000000000000, 1.0000000000000000 1.0000000000000000, 1.0000000000000000 0.0000000000000000, 0.0000000000000000 0.0000000000000000), (0.2500000000000000 0.2500000000000000, 0.2500000000000000 0.5000000000000000, 0.5000000000000000 0.5000000000000000, 0.5000000000000000 0.2500000000000000, 0.2500000000000000 0.2500000000000000)))
|
|
37
37
|
|
|
38
38
|
Sub-geometry Access
|
|
39
39
|
-------------------
|
|
@@ -41,7 +41,7 @@ Sub-geometry Access
|
|
|
41
41
|
>>> geom.geoms[0] # doctest: +ELLIPSIS
|
|
42
42
|
<shapely.geometry.polygon.Polygon object at ...>
|
|
43
43
|
>>> geom.geoms[0].wkt
|
|
44
|
-
'POLYGON ((0.0000000000000000 0.0000000000000000, 0.0000000000000000 1.0000000000000000, 1.0000000000000000 1.0000000000000000, 1.0000000000000000 0.0000000000000000, 0.0000000000000000 0.0000000000000000), (0.
|
|
44
|
+
'POLYGON ((0.0000000000000000 0.0000000000000000, 0.0000000000000000 1.0000000000000000, 1.0000000000000000 1.0000000000000000, 1.0000000000000000 0.0000000000000000, 0.0000000000000000 0.0000000000000000), (0.2500000000000000 0.2500000000000000, 0.2500000000000000 0.5000000000000000, 0.5000000000000000 0.5000000000000000, 0.5000000000000000 0.2500000000000000, 0.2500000000000000 0.2500000000000000))'
|
|
45
45
|
>>> geom.geoms[1]
|
|
46
46
|
Traceback (most recent call last):
|
|
47
47
|
...
|
|
@@ -51,14 +51,14 @@ Geo interface
|
|
|
51
51
|
-------------
|
|
52
52
|
|
|
53
53
|
>>> geom.__geo_interface__
|
|
54
|
-
{'type': 'MultiPolygon', 'coordinates': [[((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0), (0.0, 0.0)), ((0.
|
|
54
|
+
{'type': 'MultiPolygon', 'coordinates': [[((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0), (0.0, 0.0)), ((0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25), (0.25, 0.25))]]}
|
|
55
55
|
|
|
56
56
|
Adapter
|
|
57
57
|
-------
|
|
58
58
|
|
|
59
59
|
>>> from shapely.geometry import asMultiPolygon
|
|
60
60
|
>>> coords = ((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0))
|
|
61
|
-
>>> holes_coords = [((0.
|
|
61
|
+
>>> holes_coords = [((0.25,0.25), (0.25,0.5), (0.5,0.5), (0.5,0.25))]
|
|
62
62
|
>>> mpa = asMultiPolygon([(coords, holes_coords)])
|
|
63
63
|
>>> len(mpa.geoms)
|
|
64
64
|
1
|
|
@@ -77,7 +77,7 @@ Ring Access
|
|
|
77
77
|
Interior rings (holes)
|
|
78
78
|
----------------------
|
|
79
79
|
|
|
80
|
-
>>> polygon = Polygon(coords, [((0.
|
|
80
|
+
>>> polygon = Polygon(coords, [((0.25,0.25), (0.25,0.5), (0.5,0.5), (0.5,0.25))])
|
|
81
81
|
>>> len(polygon.exterior.coords)
|
|
82
82
|
5
|
|
83
83
|
>>> len(polygon.interiors[0].coords)
|
|
@@ -103,13 +103,13 @@ Geo interface
|
|
|
103
103
|
-------------
|
|
104
104
|
|
|
105
105
|
>>> polygon.__geo_interface__
|
|
106
|
-
{'type': 'Polygon', 'coordinates': (((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (2.0, -1.0), (0.0, 0.0)), ((0.
|
|
106
|
+
{'type': 'Polygon', 'coordinates': (((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (2.0, -1.0), (0.0, 0.0)), ((0.25, 0.25), (0.25, 0.5), (0.5, 0.5), (0.5, 0.25), (0.25, 0.25)))}
|
|
107
107
|
|
|
108
108
|
|
|
109
109
|
Adapter
|
|
110
110
|
-------
|
|
111
111
|
|
|
112
|
-
>>> hole_coords = [((0.
|
|
112
|
+
>>> hole_coords = [((0.25,0.25), (0.25,0.5), (0.5,0.5), (0.5,0.25))]
|
|
113
113
|
>>> from shapely.geometry import asPolygon
|
|
114
114
|
>>> pa = asPolygon(coords, hole_coords)
|
|
115
115
|
>>> len(pa.exterior.coords)
|
|
@@ -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
|
|
|
@@ -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)])
|
|
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
|
|
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
|