shapely 1.4.4__tar.gz → 1.5.1__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.
Files changed (110) hide show
  1. {Shapely-1.4.4 → Shapely-1.5.1}/CHANGES.txt +12 -0
  2. {Shapely-1.4.4 → Shapely-1.5.1}/CREDITS.txt +1 -0
  3. {Shapely-1.4.4/Shapely.egg-info → Shapely-1.5.1}/PKG-INFO +27 -49
  4. {Shapely-1.4.4 → Shapely-1.5.1}/README.rst +13 -48
  5. {Shapely-1.4.4 → Shapely-1.5.1/Shapely.egg-info}/PKG-INFO +27 -49
  6. {Shapely-1.4.4 → Shapely-1.5.1}/Shapely.egg-info/SOURCES.txt +2 -0
  7. Shapely-1.5.1/VERSION.txt +1 -0
  8. {Shapely-1.4.4 → Shapely-1.5.1}/docs/manual.rst +54 -25
  9. Shapely-1.5.1/shapely/__init__.py +1 -0
  10. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/ctypes_declarations.py +4 -0
  11. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/geometry/base.py +24 -1
  12. Shapely-1.5.1/shapely/geometry/collection.py +79 -0
  13. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/geometry/multilinestring.py +18 -36
  14. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/geometry/polygon.py +31 -13
  15. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/geos.py +1 -0
  16. Shapely-1.5.1/shapely/iterops.py +41 -0
  17. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/ops.py +26 -0
  18. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/predicates.py +9 -7
  19. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/speedups/__init__.py +9 -0
  20. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/speedups/_speedups.c +2363 -660
  21. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/topology.py +28 -10
  22. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_affinity.py +2 -4
  23. Shapely-1.5.1/tests/test_hash.py +21 -0
  24. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_iterops.py +26 -0
  25. Shapely-1.5.1/tests/test_operators.py +65 -0
  26. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_predicates.py +11 -1
  27. Shapely-1.5.1/tests/test_snap.py +32 -0
  28. Shapely-1.4.4/VERSION.txt +0 -1
  29. Shapely-1.4.4/shapely/__init__.py +0 -1
  30. Shapely-1.4.4/shapely/geometry/collection.py +0 -43
  31. Shapely-1.4.4/shapely/iterops.py +0 -55
  32. Shapely-1.4.4/tests/test_operators.py +0 -18
  33. {Shapely-1.4.4 → Shapely-1.5.1}/LICENSE.txt +0 -0
  34. {Shapely-1.4.4 → Shapely-1.5.1}/Shapely.egg-info/dependency_links.txt +0 -0
  35. {Shapely-1.4.4 → Shapely-1.5.1}/Shapely.egg-info/top_level.txt +0 -0
  36. {Shapely-1.4.4 → Shapely-1.5.1}/docs/design.rst +0 -0
  37. {Shapely-1.4.4 → Shapely-1.5.1}/docs/index.rst +0 -0
  38. {Shapely-1.4.4 → Shapely-1.5.1}/docs/project.rst +0 -0
  39. {Shapely-1.4.4 → Shapely-1.5.1}/setup.cfg +0 -0
  40. {Shapely-1.4.4 → Shapely-1.5.1}/setup.py +0 -0
  41. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/_geos.pxi +0 -0
  42. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/affinity.py +0 -0
  43. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/algorithms/__init__.py +0 -0
  44. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/algorithms/cga.py +0 -0
  45. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/coords.py +0 -0
  46. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/examples/__init__.py +0 -0
  47. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/examples/dissolve.py +0 -0
  48. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/examples/geoms.py +0 -0
  49. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/examples/intersect.py +0 -0
  50. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/ftools.py +0 -0
  51. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/geometry/__init__.py +0 -0
  52. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/geometry/geo.py +0 -0
  53. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/geometry/linestring.py +0 -0
  54. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/geometry/multipoint.py +0 -0
  55. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/geometry/multipolygon.py +0 -0
  56. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/geometry/point.py +0 -0
  57. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/geometry/proxy.py +0 -0
  58. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/impl.py +0 -0
  59. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/linref.py +0 -0
  60. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/prepared.py +0 -0
  61. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/strtree.py +0 -0
  62. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/validation.py +0 -0
  63. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/vectorized/__init__.py +0 -0
  64. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/vectorized/_vectorized.pyx +0 -0
  65. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/wkb.py +0 -0
  66. {Shapely-1.4.4 → Shapely-1.5.1}/shapely/wkt.py +0 -0
  67. {Shapely-1.4.4 → Shapely-1.5.1}/tests/__init__.py +0 -0
  68. {Shapely-1.4.4 → Shapely-1.5.1}/tests/binascii_hex.txt +0 -0
  69. {Shapely-1.4.4 → Shapely-1.5.1}/tests/conftest.py +0 -0
  70. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_box.py +0 -0
  71. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_cga.py +0 -0
  72. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_collection.py +0 -0
  73. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_coords.py +0 -0
  74. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_delaunay.py +0 -0
  75. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_delegated.py +0 -0
  76. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_dlls.py +0 -0
  77. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_doctests.py +0 -0
  78. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_emptiness.py +0 -0
  79. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_equality.py +0 -0
  80. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_geointerface.py +0 -0
  81. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_geomseq.py +0 -0
  82. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_getitem.py +0 -0
  83. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_invalid_geometries.py +0 -0
  84. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_linear_referencing.py +0 -0
  85. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_linemerge.py +0 -0
  86. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_linestring.py +0 -0
  87. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_locale.py +0 -0
  88. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_mapping.py +0 -0
  89. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_multilinestring.py +0 -0
  90. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_multipoint.py +0 -0
  91. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_multipolygon.py +0 -0
  92. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_ndarrays.py +0 -0
  93. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_nearest.py +0 -0
  94. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_operations.py +0 -0
  95. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_persist.py +0 -0
  96. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_pickle.py +0 -0
  97. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_point.py +0 -0
  98. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_polygon.py +0 -0
  99. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_polygonize.py +0 -0
  100. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_prepared.py +0 -0
  101. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_products_z.py +0 -0
  102. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_singularity.py +0 -0
  103. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_strtree.py +0 -0
  104. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_styles.py +0 -0
  105. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_transform.py +0 -0
  106. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_union.py +0 -0
  107. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_validation.py +0 -0
  108. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_vectorized.py +0 -0
  109. {Shapely-1.4.4 → Shapely-1.5.1}/tests/test_xy.py +0 -0
  110. {Shapely-1.4.4 → Shapely-1.5.1}/tests/threading_test.py +0 -0
@@ -1,6 +1,18 @@
1
1
  Changes
2
2
  =======
3
3
 
4
+ 1.5.1 (2014-12-04)
5
+ ------------------
6
+ - Restore geometry hashing (#209).
7
+
8
+ 1.5.0 (2014-12-02)
9
+ ------------------
10
+ - Affine transformation speedups (#197).
11
+ - New `==` rich comparison (#195).
12
+ - Geometry collection constructor (#200).
13
+ - ops.snap() backed by GEOSSnap (#201).
14
+ - Clearer exceptions in cases of topological invalidity (#203).
15
+
4
16
  1.4.4 (2014-11-02)
5
17
  ------------------
6
18
  - Proper conversion of numpy float32 vals to coords (#186).
@@ -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.4.4
3
+ Version: 1.5.1
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.4 requires
36
+ Shapely 1.5 requires
37
37
 
38
38
  * Python >=2.6 (including Python 3.x)
39
- * libgeos_c >=3.3 (Shapely 1.2 requires only libgeos_c 3.1 but YMMV)
39
+ * GEOS >=3.3 (Shapely 1.2 requires only GEOS 3.1 but YMMV)
40
40
 
41
- Installation
42
- ============
41
+ Installing Shapely
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
- Windows users should use the executable installer, which contains the required
45
- GEOS DLL. Other users should acquire libgeos_c by any means, make sure that it
46
- is on the system library path, and install from the Python package index.
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 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
- All linear objects, such as the rings of a polygon (like ``patch`` above),
87
- provide the Numpy array interface.
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.1 (2014-12-04)
199
+ ------------------
200
+ - Restore geometry hashing (#209).
201
+
202
+ 1.5.0 (2014-12-02)
203
+ ------------------
204
+ - Affine transformation speedups (#197).
205
+ - New `==` rich comparison (#195).
206
+ - Geometry collection constructor (#200).
207
+ - ops.snap() backed by GEOSSnap (#201).
208
+ - Clearer exceptions in cases of topological invalidity (#203).
209
+
232
210
  1.4.4 (2014-11-02)
233
211
  ------------------
234
212
  - Proper conversion of numpy float32 vals to coords (#186).
@@ -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.4 requires
28
+ Shapely 1.5 requires
29
29
 
30
30
  * Python >=2.6 (including Python 3.x)
31
- * libgeos_c >=3.3 (Shapely 1.2 requires only libgeos_c 3.1 but YMMV)
31
+ * GEOS >=3.3 (Shapely 1.2 requires only GEOS 3.1 but YMMV)
32
32
 
33
- Installation
34
- ============
33
+ Installing Shapely
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
- Windows users should use the executable installer, which contains the required
37
- GEOS DLL. Other users should acquire libgeos_c by any means, make sure that it
38
- is on the system library path, and install from the Python package index.
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 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
- All linear objects, such as the rings of a polygon (like ``patch`` above),
79
- provide the Numpy array interface.
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.4.4
3
+ Version: 1.5.1
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.4 requires
36
+ Shapely 1.5 requires
37
37
 
38
38
  * Python >=2.6 (including Python 3.x)
39
- * libgeos_c >=3.3 (Shapely 1.2 requires only libgeos_c 3.1 but YMMV)
39
+ * GEOS >=3.3 (Shapely 1.2 requires only GEOS 3.1 but YMMV)
40
40
 
41
- Installation
42
- ============
41
+ Installing Shapely
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
- Windows users should use the executable installer, which contains the required
45
- GEOS DLL. Other users should acquire libgeos_c by any means, make sure that it
46
- is on the system library path, and install from the Python package index.
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 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
- All linear objects, such as the rings of a polygon (like ``patch`` above),
87
- provide the Numpy array interface.
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.1 (2014-12-04)
199
+ ------------------
200
+ - Restore geometry hashing (#209).
201
+
202
+ 1.5.0 (2014-12-02)
203
+ ------------------
204
+ - Affine transformation speedups (#197).
205
+ - New `==` rich comparison (#195).
206
+ - Geometry collection constructor (#200).
207
+ - ops.snap() backed by GEOSSnap (#201).
208
+ - Clearer exceptions in cases of topological invalidity (#203).
209
+
232
210
  1.4.4 (2014-11-02)
233
211
  ------------------
234
212
  - Proper conversion of numpy float32 vals to coords (#186).
@@ -68,6 +68,7 @@ tests/test_equality.py
68
68
  tests/test_geointerface.py
69
69
  tests/test_geomseq.py
70
70
  tests/test_getitem.py
71
+ tests/test_hash.py
71
72
  tests/test_invalid_geometries.py
72
73
  tests/test_iterops.py
73
74
  tests/test_linear_referencing.py
@@ -91,6 +92,7 @@ tests/test_predicates.py
91
92
  tests/test_prepared.py
92
93
  tests/test_products_z.py
93
94
  tests/test_singularity.py
95
+ tests/test_snap.py
94
96
  tests/test_strtree.py
95
97
  tests/test_styles.py
96
98
  tests/test_transform.py
@@ -0,0 +1 @@
1
+ 1.5.1
@@ -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.1"
@@ -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,17 @@ 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
+
264
+ __hash__ = object.__hash__
265
+
255
266
  # Array and ctypes interfaces
256
267
  # ---------------------------
257
268
 
@@ -561,7 +572,7 @@ class BaseGeometry(object):
561
572
  @property
562
573
  def is_closed(self):
563
574
  """True if the geometry is closed, else False
564
-
575
+
565
576
  Applicable only to 1-D geometries."""
566
577
  if self.geom_type == 'LinearRing':
567
578
  return True
@@ -721,6 +732,18 @@ class BaseMultipartGeometry(BaseGeometry):
721
732
  else:
722
733
  return ()[index]
723
734
 
735
+ def __eq__(self, other):
736
+ return (
737
+ isinstance(other, self.__class__) and
738
+ len(self) == len(other) and
739
+ all(x == y for x, y in zip(self, other))
740
+ )
741
+
742
+ def __ne__(self, other):
743
+ return not self.__eq__(other)
744
+
745
+ __hash__ = object.__hash__
746
+
724
747
  def svg(self, scale_factor=1.):
725
748
  """
726
749
  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
+
@@ -117,46 +117,28 @@ def geos_multilinestring_from_py(ob):
117
117
  if isinstance(ob, MultiLineString):
118
118
  return geos_geom_from_py(ob)
119
119
 
120
+ obs = getattr(ob, 'geoms', ob)
121
+ L = len(obs)
122
+ assert L >= 1
123
+ exemplar = obs[0]
120
124
  try:
121
- # From array protocol
122
- array = ob.__array_interface__
123
- assert len(array['shape']) == 1
124
- L = array['shape'][0]
125
- assert L >= 1
126
-
127
- # Array of pointers to sub-geometries
128
- subs = (c_void_p * L)()
129
-
130
- for l in range(L):
131
- geom, ndims = linestring.geos_linestring_from_py(array['data'][l])
132
- subs[i] = cast(geom, c_void_p)
133
-
134
- if lgeos.GEOSHasZ(subs[0]):
135
- N = 3
136
- else:
137
- N = 2
138
-
139
- except (NotImplementedError, AttributeError):
140
- obs = getattr(ob, 'geoms', ob)
141
- L = len(obs)
142
- exemplar = obs[0]
143
- try:
144
- N = len(exemplar[0])
145
- except TypeError:
146
- N = exemplar._ndim
147
- assert L >= 1
148
- assert N == 2 or N == 3
149
-
150
- # Array of pointers to point geometries
151
- subs = (c_void_p * L)()
152
-
153
- # add to coordinate sequence
154
- for l in range(L):
155
- geom, ndims = linestring.geos_linestring_from_py(obs[l])
156
- subs[l] = cast(geom, c_void_p)
125
+ N = len(exemplar[0])
126
+ except TypeError:
127
+ N = exemplar._ndim
128
+ if N not in (2, 3):
129
+ raise ValueError("Invalid coordinate dimensionality")
130
+
131
+ # Array of pointers to point geometries
132
+ subs = (c_void_p * L)()
133
+
134
+ # add to coordinate sequence
135
+ for l in range(L):
136
+ geom, ndims = linestring.geos_linestring_from_py(obs[l])
137
+ subs[l] = cast(geom, c_void_p)
157
138
 
158
139
  return (lgeos.GEOSGeom_createCollection(5, subs, L), N)
159
140
 
141
+
160
142
  # Test runner
161
143
  def _test():
162
144
  import doctest