shapely 1.4.3__tar.gz → 1.5.0__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.4.3 → Shapely-1.5.0}/CHANGES.txt +12 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/CREDITS.txt +1 -0
- {Shapely-1.4.3/Shapely.egg-info → Shapely-1.5.0}/PKG-INFO +27 -49
- {Shapely-1.4.3 → Shapely-1.5.0}/README.rst +13 -48
- {Shapely-1.4.3 → Shapely-1.5.0/Shapely.egg-info}/PKG-INFO +27 -49
- {Shapely-1.4.3 → Shapely-1.5.0}/Shapely.egg-info/SOURCES.txt +2 -1
- Shapely-1.5.0/VERSION.txt +1 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/docs/manual.rst +54 -25
- Shapely-1.5.0/shapely/__init__.py +1 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/coords.py +6 -5
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/ctypes_declarations.py +4 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/geometry/base.py +20 -1
- Shapely-1.5.0/shapely/geometry/collection.py +79 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/geometry/multilinestring.py +18 -36
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/geometry/polygon.py +29 -13
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/geos.py +1 -0
- Shapely-1.5.0/shapely/iterops.py +41 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/ops.py +26 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/predicates.py +9 -7
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/speedups/__init__.py +9 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/speedups/_speedups.c +2707 -902
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/topology.py +28 -10
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_affinity.py +2 -4
- Shapely-1.5.0/tests/test_coords.py +40 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_iterops.py +26 -0
- Shapely-1.5.0/tests/test_operators.py +65 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_predicates.py +11 -1
- Shapely-1.5.0/tests/test_snap.py +32 -0
- Shapely-1.4.3/VERSION.txt +0 -1
- Shapely-1.4.3/shapely/__init__.py +0 -1
- Shapely-1.4.3/shapely/geometry/collection.py +0 -43
- Shapely-1.4.3/shapely/iterops.py +0 -55
- Shapely-1.4.3/shapely/vectorized/_vectorized.c +0 -20100
- Shapely-1.4.3/tests/test_operators.py +0 -18
- {Shapely-1.4.3 → Shapely-1.5.0}/LICENSE.txt +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/Shapely.egg-info/dependency_links.txt +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/Shapely.egg-info/top_level.txt +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/docs/design.rst +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/docs/index.rst +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/docs/project.rst +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/setup.cfg +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/setup.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/_geos.pxi +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/affinity.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/algorithms/__init__.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/algorithms/cga.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/examples/__init__.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/examples/dissolve.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/examples/geoms.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/examples/intersect.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/ftools.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/geometry/__init__.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/geometry/geo.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/geometry/linestring.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/geometry/multipoint.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/geometry/multipolygon.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/geometry/point.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/geometry/proxy.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/impl.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/linref.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/prepared.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/strtree.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/validation.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/vectorized/__init__.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/vectorized/_vectorized.pyx +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/wkb.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/shapely/wkt.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/__init__.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/binascii_hex.txt +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/conftest.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_box.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_cga.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_collection.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_delaunay.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_delegated.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_dlls.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_doctests.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_emptiness.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_equality.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_geointerface.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_geomseq.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_getitem.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_invalid_geometries.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_linear_referencing.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_linemerge.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_linestring.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_locale.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_mapping.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_multilinestring.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_multipoint.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_multipolygon.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_ndarrays.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_nearest.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_operations.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_persist.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_pickle.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_point.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_polygon.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_polygonize.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_prepared.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_products_z.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_singularity.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_strtree.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_styles.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_transform.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_union.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_validation.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_vectorized.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/test_xy.py +0 -0
- {Shapely-1.4.3 → Shapely-1.5.0}/tests/threading_test.py +0 -0
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
Changes
|
|
2
2
|
=======
|
|
3
3
|
|
|
4
|
+
1.5.0 (2014-12-02)
|
|
5
|
+
------------------
|
|
6
|
+
- Affine transformation speedups (#197).
|
|
7
|
+
- New `==` rich comparison (#195).
|
|
8
|
+
- Geometry collection constructor (#200).
|
|
9
|
+
- ops.snap() backed by GEOSSnap (#201).
|
|
10
|
+
- Clearer exceptions in cases of topological invalidity (#203).
|
|
11
|
+
|
|
12
|
+
1.4.4 (2014-11-02)
|
|
13
|
+
------------------
|
|
14
|
+
- Proper conversion of numpy float32 vals to coords (#186).
|
|
15
|
+
|
|
4
16
|
1.4.3 (2014-10-01)
|
|
5
17
|
------------------
|
|
6
18
|
- Fix for endianness bug in WKB writer (#174).
|
|
@@ -12,6 +12,7 @@ Patches contributed by:
|
|
|
12
12
|
|
|
13
13
|
* Allan Adair (https://github.com/allanadair)
|
|
14
14
|
* Joshua Arnott (https://github.com/snorfalorpagus)
|
|
15
|
+
* David Baumgold (https://github.com/singingwolfboy)
|
|
15
16
|
* Howard Butler
|
|
16
17
|
* Gabi Davar (https://github.com/mindw)
|
|
17
18
|
* Phil Elson (https://github.com/pelson)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 1.1
|
|
2
2
|
Name: Shapely
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5.0
|
|
4
4
|
Summary: Geometric objects, predicates, and operations
|
|
5
5
|
Home-page: https://github.com/Toblerity/Shapely
|
|
6
6
|
Author: Sean Gillies
|
|
@@ -33,21 +33,24 @@ Description: =======
|
|
|
33
33
|
Requirements
|
|
34
34
|
============
|
|
35
35
|
|
|
36
|
-
Shapely 1.
|
|
36
|
+
Shapely 1.5 requires
|
|
37
37
|
|
|
38
38
|
* Python >=2.6 (including Python 3.x)
|
|
39
|
-
*
|
|
39
|
+
* GEOS >=3.3 (Shapely 1.2 requires only GEOS 3.1 but YMMV)
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
Installing Shapely 1.5.0
|
|
42
|
+
========================
|
|
43
|
+
|
|
44
|
+
Windows users should download an executable installer from
|
|
45
|
+
http://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely or PyPI (if available).
|
|
43
46
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
On other systems, acquire the GEOS by any means (`brew install geos` on OS X or
|
|
48
|
+
`apt-get install libgeos-dev` on Debian/Ubuntu), make sure that it is on the
|
|
49
|
+
system library path, and install Shapely 1.5.0 from the Python package index.
|
|
47
50
|
|
|
48
51
|
.. code-block:: console
|
|
49
52
|
|
|
50
|
-
$ pip install shapely
|
|
53
|
+
$ pip install -U shapely
|
|
51
54
|
|
|
52
55
|
Shapely is also provided by popular Python distributions like Canopy (Enthought)
|
|
53
56
|
and Anaconda (Continuum Analytics).
|
|
@@ -83,46 +86,8 @@ Description: =======
|
|
|
83
86
|
>>> dumps(loads('POINT (0 0)'))
|
|
84
87
|
'POINT (0.0000000000000000 0.0000000000000000)'
|
|
85
88
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
.. code-block:: pycon
|
|
90
|
-
|
|
91
|
-
>>> import numpy as np
|
|
92
|
-
>>> np.array(patch.exterior)
|
|
93
|
-
array([[ 1.00000000e+01, 0.00000000e+00],
|
|
94
|
-
[ 9.95184727e+00, -9.80171403e-01],
|
|
95
|
-
[ 9.80785280e+00, -1.95090322e+00],
|
|
96
|
-
...
|
|
97
|
-
[ 1.00000000e+01, 0.00000000e+00]])
|
|
98
|
-
|
|
99
|
-
That yields a Numpy array of ``[x, y]`` arrays. This is not always exactly what one
|
|
100
|
-
wants for plotting shapes with Matplotlib (for example), so Shapely adds
|
|
101
|
-
a ``xy`` property for obtaining separate arrays of coordinate x and y values.
|
|
102
|
-
|
|
103
|
-
.. code-block:: pycon
|
|
104
|
-
|
|
105
|
-
>>> x, y = patch.exterior.xy
|
|
106
|
-
>>> np.array(x)
|
|
107
|
-
array([ 1.00000000e+01, 9.95184727e+00, 9.80785280e+00, ...])
|
|
108
|
-
|
|
109
|
-
Numpy arrays of ``[x, y]`` arrays can also be adapted to Shapely linestrings.
|
|
110
|
-
|
|
111
|
-
.. code-block:: pycon
|
|
112
|
-
|
|
113
|
-
>>> from shapely.geometry import LineString
|
|
114
|
-
>>> LineString(np.array(patch.exterior)).length
|
|
115
|
-
62.806623139095073
|
|
116
|
-
|
|
117
|
-
Numpy arrays of x and y must be transposed.
|
|
118
|
-
|
|
119
|
-
.. code-block:: pycon
|
|
120
|
-
|
|
121
|
-
>>> LineString(np.transpose(np.array(patch.exterior.xy))).length
|
|
122
|
-
62.80662313909507
|
|
123
|
-
|
|
124
|
-
Shapely can also integrate with other Python GIS packages using data modeled
|
|
125
|
-
after GeoJSON.
|
|
89
|
+
Shapely can also integrate with other Python GIS packages using GeoJSON-like
|
|
90
|
+
dicts.
|
|
126
91
|
|
|
127
92
|
.. code-block:: pycon
|
|
128
93
|
|
|
@@ -186,6 +151,7 @@ Description: =======
|
|
|
186
151
|
|
|
187
152
|
* Allan Adair (https://github.com/allanadair)
|
|
188
153
|
* Joshua Arnott (https://github.com/snorfalorpagus)
|
|
154
|
+
* David Baumgold (https://github.com/singingwolfboy)
|
|
189
155
|
* Howard Butler
|
|
190
156
|
* Gabi Davar (https://github.com/mindw)
|
|
191
157
|
* Phil Elson (https://github.com/pelson)
|
|
@@ -229,6 +195,18 @@ Description: =======
|
|
|
229
195
|
Changes
|
|
230
196
|
=======
|
|
231
197
|
|
|
198
|
+
1.5.0 (2014-12-02)
|
|
199
|
+
------------------
|
|
200
|
+
- Affine transformation speedups (#197).
|
|
201
|
+
- New `==` rich comparison (#195).
|
|
202
|
+
- Geometry collection constructor (#200).
|
|
203
|
+
- ops.snap() backed by GEOSSnap (#201).
|
|
204
|
+
- Clearer exceptions in cases of topological invalidity (#203).
|
|
205
|
+
|
|
206
|
+
1.4.4 (2014-11-02)
|
|
207
|
+
------------------
|
|
208
|
+
- Proper conversion of numpy float32 vals to coords (#186).
|
|
209
|
+
|
|
232
210
|
1.4.3 (2014-10-01)
|
|
233
211
|
------------------
|
|
234
212
|
- Fix for endianness bug in WKB writer (#174).
|
|
@@ -25,21 +25,24 @@ but can be readily integrated with packages that are. For more details, see:
|
|
|
25
25
|
Requirements
|
|
26
26
|
============
|
|
27
27
|
|
|
28
|
-
Shapely 1.
|
|
28
|
+
Shapely 1.5 requires
|
|
29
29
|
|
|
30
30
|
* Python >=2.6 (including Python 3.x)
|
|
31
|
-
*
|
|
31
|
+
* GEOS >=3.3 (Shapely 1.2 requires only GEOS 3.1 but YMMV)
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
Installing Shapely 1.5.0
|
|
34
|
+
========================
|
|
35
|
+
|
|
36
|
+
Windows users should download an executable installer from
|
|
37
|
+
http://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely or PyPI (if available).
|
|
35
38
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
On other systems, acquire the GEOS by any means (`brew install geos` on OS X or
|
|
40
|
+
`apt-get install libgeos-dev` on Debian/Ubuntu), make sure that it is on the
|
|
41
|
+
system library path, and install Shapely 1.5.0 from the Python package index.
|
|
39
42
|
|
|
40
43
|
.. code-block:: console
|
|
41
44
|
|
|
42
|
-
$ pip install shapely
|
|
45
|
+
$ pip install -U shapely
|
|
43
46
|
|
|
44
47
|
Shapely is also provided by popular Python distributions like Canopy (Enthought)
|
|
45
48
|
and Anaconda (Continuum Analytics).
|
|
@@ -75,46 +78,8 @@ modules provide dumpers and loaders inspired by Python's pickle module.
|
|
|
75
78
|
>>> dumps(loads('POINT (0 0)'))
|
|
76
79
|
'POINT (0.0000000000000000 0.0000000000000000)'
|
|
77
80
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
.. code-block:: pycon
|
|
82
|
-
|
|
83
|
-
>>> import numpy as np
|
|
84
|
-
>>> np.array(patch.exterior)
|
|
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 adds
|
|
93
|
-
a ``xy`` property for obtaining separate arrays of coordinate x and y values.
|
|
94
|
-
|
|
95
|
-
.. code-block:: pycon
|
|
96
|
-
|
|
97
|
-
>>> x, y = patch.exterior.xy
|
|
98
|
-
>>> np.array(x)
|
|
99
|
-
array([ 1.00000000e+01, 9.95184727e+00, 9.80785280e+00, ...])
|
|
100
|
-
|
|
101
|
-
Numpy arrays of ``[x, y]`` arrays can also be adapted to Shapely linestrings.
|
|
102
|
-
|
|
103
|
-
.. code-block:: pycon
|
|
104
|
-
|
|
105
|
-
>>> from shapely.geometry import LineString
|
|
106
|
-
>>> LineString(np.array(patch.exterior)).length
|
|
107
|
-
62.806623139095073
|
|
108
|
-
|
|
109
|
-
Numpy arrays of x and y must be transposed.
|
|
110
|
-
|
|
111
|
-
.. code-block:: pycon
|
|
112
|
-
|
|
113
|
-
>>> LineString(np.transpose(np.array(patch.exterior.xy))).length
|
|
114
|
-
62.80662313909507
|
|
115
|
-
|
|
116
|
-
Shapely can also integrate with other Python GIS packages using data modeled
|
|
117
|
-
after GeoJSON.
|
|
81
|
+
Shapely can also integrate with other Python GIS packages using GeoJSON-like
|
|
82
|
+
dicts.
|
|
118
83
|
|
|
119
84
|
.. code-block:: pycon
|
|
120
85
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 1.1
|
|
2
2
|
Name: Shapely
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5.0
|
|
4
4
|
Summary: Geometric objects, predicates, and operations
|
|
5
5
|
Home-page: https://github.com/Toblerity/Shapely
|
|
6
6
|
Author: Sean Gillies
|
|
@@ -33,21 +33,24 @@ Description: =======
|
|
|
33
33
|
Requirements
|
|
34
34
|
============
|
|
35
35
|
|
|
36
|
-
Shapely 1.
|
|
36
|
+
Shapely 1.5 requires
|
|
37
37
|
|
|
38
38
|
* Python >=2.6 (including Python 3.x)
|
|
39
|
-
*
|
|
39
|
+
* GEOS >=3.3 (Shapely 1.2 requires only GEOS 3.1 but YMMV)
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
Installing Shapely 1.5.0
|
|
42
|
+
========================
|
|
43
|
+
|
|
44
|
+
Windows users should download an executable installer from
|
|
45
|
+
http://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely or PyPI (if available).
|
|
43
46
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
On other systems, acquire the GEOS by any means (`brew install geos` on OS X or
|
|
48
|
+
`apt-get install libgeos-dev` on Debian/Ubuntu), make sure that it is on the
|
|
49
|
+
system library path, and install Shapely 1.5.0 from the Python package index.
|
|
47
50
|
|
|
48
51
|
.. code-block:: console
|
|
49
52
|
|
|
50
|
-
$ pip install shapely
|
|
53
|
+
$ pip install -U shapely
|
|
51
54
|
|
|
52
55
|
Shapely is also provided by popular Python distributions like Canopy (Enthought)
|
|
53
56
|
and Anaconda (Continuum Analytics).
|
|
@@ -83,46 +86,8 @@ Description: =======
|
|
|
83
86
|
>>> dumps(loads('POINT (0 0)'))
|
|
84
87
|
'POINT (0.0000000000000000 0.0000000000000000)'
|
|
85
88
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
.. code-block:: pycon
|
|
90
|
-
|
|
91
|
-
>>> import numpy as np
|
|
92
|
-
>>> np.array(patch.exterior)
|
|
93
|
-
array([[ 1.00000000e+01, 0.00000000e+00],
|
|
94
|
-
[ 9.95184727e+00, -9.80171403e-01],
|
|
95
|
-
[ 9.80785280e+00, -1.95090322e+00],
|
|
96
|
-
...
|
|
97
|
-
[ 1.00000000e+01, 0.00000000e+00]])
|
|
98
|
-
|
|
99
|
-
That yields a Numpy array of ``[x, y]`` arrays. This is not always exactly what one
|
|
100
|
-
wants for plotting shapes with Matplotlib (for example), so Shapely adds
|
|
101
|
-
a ``xy`` property for obtaining separate arrays of coordinate x and y values.
|
|
102
|
-
|
|
103
|
-
.. code-block:: pycon
|
|
104
|
-
|
|
105
|
-
>>> x, y = patch.exterior.xy
|
|
106
|
-
>>> np.array(x)
|
|
107
|
-
array([ 1.00000000e+01, 9.95184727e+00, 9.80785280e+00, ...])
|
|
108
|
-
|
|
109
|
-
Numpy arrays of ``[x, y]`` arrays can also be adapted to Shapely linestrings.
|
|
110
|
-
|
|
111
|
-
.. code-block:: pycon
|
|
112
|
-
|
|
113
|
-
>>> from shapely.geometry import LineString
|
|
114
|
-
>>> LineString(np.array(patch.exterior)).length
|
|
115
|
-
62.806623139095073
|
|
116
|
-
|
|
117
|
-
Numpy arrays of x and y must be transposed.
|
|
118
|
-
|
|
119
|
-
.. code-block:: pycon
|
|
120
|
-
|
|
121
|
-
>>> LineString(np.transpose(np.array(patch.exterior.xy))).length
|
|
122
|
-
62.80662313909507
|
|
123
|
-
|
|
124
|
-
Shapely can also integrate with other Python GIS packages using data modeled
|
|
125
|
-
after GeoJSON.
|
|
89
|
+
Shapely can also integrate with other Python GIS packages using GeoJSON-like
|
|
90
|
+
dicts.
|
|
126
91
|
|
|
127
92
|
.. code-block:: pycon
|
|
128
93
|
|
|
@@ -186,6 +151,7 @@ Description: =======
|
|
|
186
151
|
|
|
187
152
|
* Allan Adair (https://github.com/allanadair)
|
|
188
153
|
* Joshua Arnott (https://github.com/snorfalorpagus)
|
|
154
|
+
* David Baumgold (https://github.com/singingwolfboy)
|
|
189
155
|
* Howard Butler
|
|
190
156
|
* Gabi Davar (https://github.com/mindw)
|
|
191
157
|
* Phil Elson (https://github.com/pelson)
|
|
@@ -229,6 +195,18 @@ Description: =======
|
|
|
229
195
|
Changes
|
|
230
196
|
=======
|
|
231
197
|
|
|
198
|
+
1.5.0 (2014-12-02)
|
|
199
|
+
------------------
|
|
200
|
+
- Affine transformation speedups (#197).
|
|
201
|
+
- New `==` rich comparison (#195).
|
|
202
|
+
- Geometry collection constructor (#200).
|
|
203
|
+
- ops.snap() backed by GEOSSnap (#201).
|
|
204
|
+
- Clearer exceptions in cases of topological invalidity (#203).
|
|
205
|
+
|
|
206
|
+
1.4.4 (2014-11-02)
|
|
207
|
+
------------------
|
|
208
|
+
- Proper conversion of numpy float32 vals to coords (#186).
|
|
209
|
+
|
|
232
210
|
1.4.3 (2014-10-01)
|
|
233
211
|
------------------
|
|
234
212
|
- Fix for endianness bug in WKB writer (#174).
|
|
@@ -50,7 +50,6 @@ shapely/geometry/proxy.py
|
|
|
50
50
|
shapely/speedups/__init__.py
|
|
51
51
|
shapely/speedups/_speedups.c
|
|
52
52
|
shapely/vectorized/__init__.py
|
|
53
|
-
shapely/vectorized/_vectorized.c
|
|
54
53
|
shapely/vectorized/_vectorized.pyx
|
|
55
54
|
tests/__init__.py
|
|
56
55
|
tests/binascii_hex.txt
|
|
@@ -59,6 +58,7 @@ tests/test_affinity.py
|
|
|
59
58
|
tests/test_box.py
|
|
60
59
|
tests/test_cga.py
|
|
61
60
|
tests/test_collection.py
|
|
61
|
+
tests/test_coords.py
|
|
62
62
|
tests/test_delaunay.py
|
|
63
63
|
tests/test_delegated.py
|
|
64
64
|
tests/test_dlls.py
|
|
@@ -91,6 +91,7 @@ tests/test_predicates.py
|
|
|
91
91
|
tests/test_prepared.py
|
|
92
92
|
tests/test_products_z.py
|
|
93
93
|
tests/test_singularity.py
|
|
94
|
+
tests/test_snap.py
|
|
94
95
|
tests/test_strtree.py
|
|
95
96
|
tests/test_styles.py
|
|
96
97
|
tests/test_transform.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.5.0
|
|
@@ -1018,13 +1018,40 @@ evaluate topological, set-theoretic relationships. In a few cases the results
|
|
|
1018
1018
|
may not be what one might expect starting from different assumptions. All take
|
|
1019
1019
|
another geometric object as argument and return ``True`` or ``False``.
|
|
1020
1020
|
|
|
1021
|
+
.. method:: object.__eq__(other)
|
|
1022
|
+
|
|
1023
|
+
Returns ``True`` if the two objects are of the same geometric type, and
|
|
1024
|
+
the coordinates of the two objects match precisely.
|
|
1025
|
+
|
|
1026
|
+
.. method:: object.equals(other)
|
|
1027
|
+
|
|
1028
|
+
Returns ``True`` if the set-theoretic `boundary`, `interior`, and `exterior`
|
|
1029
|
+
of the object coincide with those of the other.
|
|
1030
|
+
|
|
1031
|
+
The coordinates passed to the object constructors are of these sets, and
|
|
1032
|
+
determine them, but are not the entirety of the sets. This is a potential
|
|
1033
|
+
"gotcha" for new users. Equivalent lines, for example, can be constructed
|
|
1034
|
+
differently.
|
|
1035
|
+
|
|
1036
|
+
.. code-block:: pycon
|
|
1037
|
+
|
|
1038
|
+
>>> a = LineString([(0, 0), (1, 1)])
|
|
1039
|
+
>>> b = LineString([(0, 0), (0.5, 0.5), (1, 1)])
|
|
1040
|
+
>>> c = LineString([(0, 0), (0, 0), (1, 1)])
|
|
1041
|
+
>>> a.equals(b)
|
|
1042
|
+
True
|
|
1043
|
+
>>> a == b
|
|
1044
|
+
False
|
|
1045
|
+
>>> b.equals(c)
|
|
1046
|
+
True
|
|
1047
|
+
>>> b == c
|
|
1048
|
+
False
|
|
1049
|
+
|
|
1021
1050
|
.. method:: object.almost_equals(other[, decimal=6])
|
|
1022
1051
|
|
|
1023
1052
|
Returns ``True`` if the object is approximately equal to the `other` at all
|
|
1024
1053
|
points to specified `decimal` place precision.
|
|
1025
1054
|
|
|
1026
|
-
See also :meth:`equals`.
|
|
1027
|
-
|
|
1028
1055
|
.. method:: object.contains(other)
|
|
1029
1056
|
|
|
1030
1057
|
Returns ``True`` if the object's `interior` contains the `boundary` and
|
|
@@ -1092,29 +1119,6 @@ A line does not cross a point that it contains.
|
|
|
1092
1119
|
|
|
1093
1120
|
This predicate applies to all types and is the inverse of :meth:`intersects`.
|
|
1094
1121
|
|
|
1095
|
-
.. method:: object.equals(other)
|
|
1096
|
-
|
|
1097
|
-
Returns ``True`` if the set-theoretic `boundary`, `interior`, and `exterior`
|
|
1098
|
-
of the object coincide with those of the other.
|
|
1099
|
-
|
|
1100
|
-
The coordinates passed to the object constructors are of these sets, and
|
|
1101
|
-
determine them, but are not the entirety of the sets. This is a potential
|
|
1102
|
-
"gotcha" for new users. Equivalent lines, for example, can be constructed
|
|
1103
|
-
differently.
|
|
1104
|
-
|
|
1105
|
-
.. code-block:: pycon
|
|
1106
|
-
|
|
1107
|
-
>>> a = LineString([(0, 0), (1, 1)])
|
|
1108
|
-
>>> b = LineString([(0, 0), (0.5, 0.5), (1, 1)])
|
|
1109
|
-
>>> c = LineString([(0, 0), (0, 0), (1, 1)])
|
|
1110
|
-
>>> a.equals(b)
|
|
1111
|
-
True
|
|
1112
|
-
>>> b.equals(c)
|
|
1113
|
-
True
|
|
1114
|
-
|
|
1115
|
-
This predicate should not be mistaken for Python's ``==`` or ``is``
|
|
1116
|
-
constructions.
|
|
1117
|
-
|
|
1118
1122
|
.. method:: object.intersects(other)
|
|
1119
1123
|
|
|
1120
1124
|
Returns ``True`` if the `boundary` and `interior` of the object intersect in
|
|
@@ -2019,6 +2023,31 @@ the nearest points in a pair of geometries.
|
|
|
2019
2023
|
|
|
2020
2024
|
Note that the nearest points may not be existing vertices in the geometries.
|
|
2021
2025
|
|
|
2026
|
+
Snapping
|
|
2027
|
+
--------
|
|
2028
|
+
|
|
2029
|
+
The :func:`~shapely.ops.snap` function in `shapely.ops` snaps the vertices in
|
|
2030
|
+
one geometry to the vertices in a second geometry with a given tolerance.
|
|
2031
|
+
|
|
2032
|
+
.. function:: shapely.ops.snap(geom1, geom2, tolerance)
|
|
2033
|
+
|
|
2034
|
+
Snaps vertices in `geom1` to vertices in the `geom2`. A copy of the snapped
|
|
2035
|
+
geometry is returned. The input geometries are not modified.
|
|
2036
|
+
|
|
2037
|
+
The `tolerance` argument specifies the minimum distance between vertices for
|
|
2038
|
+
them to be snapped.
|
|
2039
|
+
|
|
2040
|
+
`New in version 1.4.5`
|
|
2041
|
+
|
|
2042
|
+
.. code-block:: pycon
|
|
2043
|
+
|
|
2044
|
+
>>> from shapely.ops import snap
|
|
2045
|
+
>>> square = Polygon([(1,1), (2, 1), (2, 2), (1, 2), (1, 1)])
|
|
2046
|
+
>>> line = LineString([(0,0), (0.8, 0.8), (1.8, 0.95), (2.6, 0.5)])
|
|
2047
|
+
>>> result = snap(line, square, 0.5)
|
|
2048
|
+
>>> result.wkt
|
|
2049
|
+
'LINESTRING (0 0, 1 1, 2 1, 2.6 0.5)'
|
|
2050
|
+
|
|
2022
2051
|
Prepared Geometry Operations
|
|
2023
2052
|
----------------------------
|
|
2024
2053
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.5.0"
|
|
@@ -21,13 +21,14 @@ def required(ob):
|
|
|
21
21
|
"""Return an object that meets Shapely requirements for self-owned
|
|
22
22
|
C-continguous data, copying if necessary, or just return the original
|
|
23
23
|
object."""
|
|
24
|
-
if
|
|
25
|
-
|
|
26
|
-
if has_numpy:
|
|
27
|
-
return numpy.require(ob, numpy.float64, ["C", "OWNDATA"])
|
|
28
|
-
else:
|
|
24
|
+
if hasattr(ob, '__array_interface__'):
|
|
25
|
+
if ob.__array_interface__.get('strides') and not has_numpy:
|
|
29
26
|
# raise an error if strided. See issue #52.
|
|
30
27
|
raise ValueError("C-contiguous data is required")
|
|
28
|
+
else:
|
|
29
|
+
# numpy.require will just return (ob) if it is already
|
|
30
|
+
# float64 and well-behaved.
|
|
31
|
+
return numpy.require(ob, numpy.float64, ["C", "OWNDATA"])
|
|
31
32
|
else:
|
|
32
33
|
return ob
|
|
33
34
|
|
|
@@ -466,6 +466,10 @@ def prototype(lgeos, geos_version):
|
|
|
466
466
|
lgeos.GEOSFree.restype = None
|
|
467
467
|
lgeos.GEOSFree.argtypes = [c_void_p]
|
|
468
468
|
|
|
469
|
+
if geos_version >= (3, 3, 0):
|
|
470
|
+
lgeos.GEOSSnap.restype = c_void_p
|
|
471
|
+
lgeos.GEOSSnap.argtypes = [c_void_p, c_void_p, c_double]
|
|
472
|
+
|
|
469
473
|
if geos_version >= (3, 4, 0):
|
|
470
474
|
lgeos.GEOSNearestPoints.restype = c_void_p
|
|
471
475
|
lgeos.GEOSNearestPoints.argtypes = [c_void_p, c_void_p]
|
|
@@ -252,6 +252,15 @@ class BaseGeometry(object):
|
|
|
252
252
|
def __xor__(self, other):
|
|
253
253
|
return self.symmetric_difference(other)
|
|
254
254
|
|
|
255
|
+
def __eq__(self, other):
|
|
256
|
+
return (
|
|
257
|
+
isinstance(other, self.__class__) and
|
|
258
|
+
tuple(self.coords) == tuple(other.coords)
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
def __ne__(self, other):
|
|
262
|
+
return not self.__eq__(other)
|
|
263
|
+
|
|
255
264
|
# Array and ctypes interfaces
|
|
256
265
|
# ---------------------------
|
|
257
266
|
|
|
@@ -561,7 +570,7 @@ class BaseGeometry(object):
|
|
|
561
570
|
@property
|
|
562
571
|
def is_closed(self):
|
|
563
572
|
"""True if the geometry is closed, else False
|
|
564
|
-
|
|
573
|
+
|
|
565
574
|
Applicable only to 1-D geometries."""
|
|
566
575
|
if self.geom_type == 'LinearRing':
|
|
567
576
|
return True
|
|
@@ -721,6 +730,16 @@ class BaseMultipartGeometry(BaseGeometry):
|
|
|
721
730
|
else:
|
|
722
731
|
return ()[index]
|
|
723
732
|
|
|
733
|
+
def __eq__(self, other):
|
|
734
|
+
return (
|
|
735
|
+
isinstance(other, self.__class__) and
|
|
736
|
+
len(self) == len(other) and
|
|
737
|
+
all(x == y for x, y in zip(self, other))
|
|
738
|
+
)
|
|
739
|
+
|
|
740
|
+
def __ne__(self, other):
|
|
741
|
+
return not self.__eq__(other)
|
|
742
|
+
|
|
724
743
|
def svg(self, scale_factor=1.):
|
|
725
744
|
"""
|
|
726
745
|
SVG representation of the geometry. Scale factor is multiplied by
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"""Multi-part collections of geometries
|
|
2
|
+
"""
|
|
3
|
+
|
|
4
|
+
from ctypes import c_void_p
|
|
5
|
+
|
|
6
|
+
from shapely.geos import lgeos
|
|
7
|
+
from shapely.geometry.base import BaseGeometry
|
|
8
|
+
from shapely.geometry.base import BaseMultipartGeometry
|
|
9
|
+
from shapely.geometry.base import HeterogeneousGeometrySequence
|
|
10
|
+
from shapely.geometry.base import geos_geom_from_py
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class GeometryCollection(BaseMultipartGeometry):
|
|
14
|
+
|
|
15
|
+
"""A heterogenous collection of geometries
|
|
16
|
+
|
|
17
|
+
Attributes
|
|
18
|
+
----------
|
|
19
|
+
geoms : sequence
|
|
20
|
+
A sequence of Shapely geometry instances
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
def __init__(self, geoms=None):
|
|
24
|
+
"""
|
|
25
|
+
Parameters
|
|
26
|
+
----------
|
|
27
|
+
geoms : list
|
|
28
|
+
A list of shapely geometry instances, which may be heterogenous.
|
|
29
|
+
|
|
30
|
+
Example
|
|
31
|
+
-------
|
|
32
|
+
Create a GeometryCollection with a Point and a LineString
|
|
33
|
+
|
|
34
|
+
>>> p = Point(51, -1)
|
|
35
|
+
>>> l = LineString([(52, -1), (49, 2)])
|
|
36
|
+
>>> gc = GeometryCollection([p, l])
|
|
37
|
+
"""
|
|
38
|
+
BaseMultipartGeometry.__init__(self)
|
|
39
|
+
if not geoms:
|
|
40
|
+
pass
|
|
41
|
+
else:
|
|
42
|
+
self._geom, self._ndim = geos_geometrycollection_from_py(geoms)
|
|
43
|
+
|
|
44
|
+
@property
|
|
45
|
+
def __geo_interface__(self):
|
|
46
|
+
geometries = []
|
|
47
|
+
for geom in self.geoms:
|
|
48
|
+
geometries.append(geom.__geo_interface__)
|
|
49
|
+
return dict(type='GeometryCollection', geometries=geometries)
|
|
50
|
+
|
|
51
|
+
@property
|
|
52
|
+
def geoms(self):
|
|
53
|
+
if self.is_empty:
|
|
54
|
+
return []
|
|
55
|
+
return HeterogeneousGeometrySequence(self)
|
|
56
|
+
|
|
57
|
+
def geos_geometrycollection_from_py(ob):
|
|
58
|
+
"""Creates a GEOS GeometryCollection from a list of geometries"""
|
|
59
|
+
L = len(ob)
|
|
60
|
+
N = 2
|
|
61
|
+
subs = (c_void_p * L)()
|
|
62
|
+
for l in range(L):
|
|
63
|
+
assert(isinstance(ob[l], BaseGeometry))
|
|
64
|
+
if ob[l].has_z:
|
|
65
|
+
N = 3
|
|
66
|
+
geom, n = geos_geom_from_py(ob[l])
|
|
67
|
+
subs[l] = geom
|
|
68
|
+
|
|
69
|
+
return (lgeos.GEOSGeom_createCollection(7, subs, L), N)
|
|
70
|
+
|
|
71
|
+
# Test runner
|
|
72
|
+
def _test():
|
|
73
|
+
import doctest
|
|
74
|
+
doctest.testmod()
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
if __name__ == "__main__":
|
|
78
|
+
_test()
|
|
79
|
+
|