shapely 1.8.2__tar.gz → 1.8.3__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 (148) hide show
  1. {Shapely-1.8.2 → Shapely-1.8.3}/CHANGES.txt +26 -1
  2. {Shapely-1.8.2/Shapely.egg-info → Shapely-1.8.3}/PKG-INFO +27 -5
  3. {Shapely-1.8.2 → Shapely-1.8.3/Shapely.egg-info}/PKG-INFO +27 -5
  4. Shapely-1.8.3/VERSION.txt +1 -0
  5. Shapely-1.8.3/pyproject.toml +6 -0
  6. Shapely-1.8.3/shapely/__init__.py +1 -0
  7. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/ctypes_declarations.py +45 -20
  8. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/geometry/base.py +15 -9
  9. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/geometry/collection.py +2 -1
  10. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/geometry/multilinestring.py +7 -6
  11. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/geometry/multipoint.py +3 -2
  12. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/geometry/multipolygon.py +5 -4
  13. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/geometry/polygon.py +7 -5
  14. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/geometry/proxy.py +5 -2
  15. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/ops.py +29 -13
  16. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/strtree.py +21 -2
  17. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/topology.py +7 -3
  18. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_geos_err_handler.py +8 -4
  19. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_linear_referencing.py +6 -3
  20. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_parallel_offset.py +4 -2
  21. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_shared_paths.py +15 -10
  22. Shapely-1.8.3/tests/test_split.py +247 -0
  23. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_strtree.py +29 -14
  24. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_substring.py +5 -2
  25. Shapely-1.8.2/VERSION.txt +0 -1
  26. Shapely-1.8.2/pyproject.toml +0 -2
  27. Shapely-1.8.2/shapely/__init__.py +0 -1
  28. Shapely-1.8.2/tests/test_split.py +0 -230
  29. {Shapely-1.8.2 → Shapely-1.8.3}/CREDITS.txt +0 -0
  30. {Shapely-1.8.2 → Shapely-1.8.3}/LICENSE.txt +0 -0
  31. {Shapely-1.8.2 → Shapely-1.8.3}/README.rst +0 -0
  32. {Shapely-1.8.2 → Shapely-1.8.3}/Shapely.egg-info/SOURCES.txt +0 -0
  33. {Shapely-1.8.2 → Shapely-1.8.3}/Shapely.egg-info/dependency_links.txt +0 -0
  34. {Shapely-1.8.2 → Shapely-1.8.3}/Shapely.egg-info/requires.txt +0 -0
  35. {Shapely-1.8.2 → Shapely-1.8.3}/Shapely.egg-info/top_level.txt +0 -0
  36. {Shapely-1.8.2 → Shapely-1.8.3}/_vendor/__init__.py +0 -0
  37. {Shapely-1.8.2 → Shapely-1.8.3}/_vendor/packaging/__about__.py +0 -0
  38. {Shapely-1.8.2 → Shapely-1.8.3}/_vendor/packaging/__init__.py +0 -0
  39. {Shapely-1.8.2 → Shapely-1.8.3}/_vendor/packaging/_compat.py +0 -0
  40. {Shapely-1.8.2 → Shapely-1.8.3}/_vendor/packaging/_structures.py +0 -0
  41. {Shapely-1.8.2 → Shapely-1.8.3}/_vendor/packaging/markers.py +0 -0
  42. {Shapely-1.8.2 → Shapely-1.8.3}/_vendor/packaging/requirements.py +0 -0
  43. {Shapely-1.8.2 → Shapely-1.8.3}/_vendor/packaging/specifiers.py +0 -0
  44. {Shapely-1.8.2 → Shapely-1.8.3}/_vendor/packaging/utils.py +0 -0
  45. {Shapely-1.8.2 → Shapely-1.8.3}/_vendor/packaging/version.py +0 -0
  46. {Shapely-1.8.2 → Shapely-1.8.3}/docs/design.rst +0 -0
  47. {Shapely-1.8.2 → Shapely-1.8.3}/docs/index.rst +0 -0
  48. {Shapely-1.8.2 → Shapely-1.8.3}/docs/manual.rst +0 -0
  49. {Shapely-1.8.2 → Shapely-1.8.3}/docs/migration.rst +0 -0
  50. {Shapely-1.8.2 → Shapely-1.8.3}/docs/project.rst +0 -0
  51. {Shapely-1.8.2 → Shapely-1.8.3}/setup.cfg +0 -0
  52. {Shapely-1.8.2 → Shapely-1.8.3}/setup.py +0 -0
  53. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/_buildcfg.py +0 -0
  54. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/_geos.pxi +0 -0
  55. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/affinity.py +0 -0
  56. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/algorithms/__init__.py +0 -0
  57. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/algorithms/cga.py +0 -0
  58. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/algorithms/polylabel.py +0 -0
  59. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/coords.py +0 -0
  60. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/errors.py +0 -0
  61. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/examples/__init__.py +0 -0
  62. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/examples/dissolve.py +0 -0
  63. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/examples/geoms.py +0 -0
  64. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/examples/intersect.py +0 -0
  65. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/geometry/__init__.py +0 -0
  66. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/geometry/conftest.py +0 -0
  67. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/geometry/geo.py +0 -0
  68. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/geometry/linestring.py +0 -0
  69. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/geometry/point.py +0 -0
  70. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/geos.py +0 -0
  71. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/impl.py +0 -0
  72. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/iterops.py +0 -0
  73. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/linref.py +0 -0
  74. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/predicates.py +0 -0
  75. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/prepared.py +0 -0
  76. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/speedups/__init__.py +0 -0
  77. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/speedups/_speedups.pyx +0 -0
  78. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/validation.py +0 -0
  79. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/vectorized/__init__.py +0 -0
  80. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/vectorized/_vectorized.pyx +0 -0
  81. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/wkb.py +0 -0
  82. {Shapely-1.8.2 → Shapely-1.8.3}/shapely/wkt.py +0 -0
  83. {Shapely-1.8.2 → Shapely-1.8.3}/tests/__init__.py +0 -0
  84. {Shapely-1.8.2 → Shapely-1.8.3}/tests/conftest.py +0 -0
  85. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_affinity.py +0 -0
  86. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_binascii_hex.txt +0 -0
  87. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_box.py +0 -0
  88. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_buffer.py +0 -0
  89. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_cga.py +0 -0
  90. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_clip_by_rect.py +0 -0
  91. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_collection.py +0 -0
  92. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_coords.py +0 -0
  93. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_create_inconsistent_dimensionality.py +0 -0
  94. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_default_impl.py +0 -0
  95. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_delaunay.py +0 -0
  96. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_delegated.py +0 -0
  97. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_dlls.py +0 -0
  98. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_doctests.py +0 -0
  99. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_emptiness.py +0 -0
  100. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_empty_polygons.py +0 -0
  101. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_equality.py +0 -0
  102. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_geointerface.py +0 -0
  103. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_geometry_base.py +0 -0
  104. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_geomseq.py +0 -0
  105. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_getitem.py +0 -0
  106. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_hash.py +0 -0
  107. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_invalid_geometries.py +0 -0
  108. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_iterops.py +0 -0
  109. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_linemerge.py +0 -0
  110. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_linestring.py +0 -0
  111. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_locale.py +0 -0
  112. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_make_valid.py +0 -0
  113. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_mapping.py +0 -0
  114. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_minimum_clearance.py +0 -0
  115. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_minimum_rotated_rectangle.py +0 -0
  116. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_multi.py +0 -0
  117. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_multilinestring.py +0 -0
  118. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_multipoint.py +0 -0
  119. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_multipolygon.py +0 -0
  120. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_ndarrays.py +0 -0
  121. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_nearest.py +0 -0
  122. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_operations.py +0 -0
  123. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_operators.py +0 -0
  124. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_orient.py +0 -0
  125. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_persist.py +0 -0
  126. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_pickle.py +0 -0
  127. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_point.py +0 -0
  128. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_polygon.py +0 -0
  129. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_polygonize.py +0 -0
  130. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_polylabel.py +0 -0
  131. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_predicates.py +0 -0
  132. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_prepared.py +0 -0
  133. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_products_z.py +0 -0
  134. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_shape.py +0 -0
  135. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_singularity.py +0 -0
  136. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_snap.py +0 -0
  137. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_styles.py +0 -0
  138. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_svg.py +0 -0
  139. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_transform.py +0 -0
  140. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_union.py +0 -0
  141. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_validation.py +0 -0
  142. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_vectorized.py +0 -0
  143. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_voronoi_diagram.py +0 -0
  144. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_wkb.py +0 -0
  145. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_wkt.py +0 -0
  146. {Shapely-1.8.2 → Shapely-1.8.3}/tests/test_xy.py +0 -0
  147. {Shapely-1.8.2 → Shapely-1.8.3}/tests/threading_test.py +0 -0
  148. {Shapely-1.8.2 → Shapely-1.8.3}/tests/unpickle-strtree.py +0 -0
@@ -1,6 +1,31 @@
1
1
  Changes
2
2
  =======
3
3
 
4
+ 1.8.3 (2022-08-16)
5
+ ------------------
6
+
7
+ Deprecations:
8
+
9
+ The STRtree class will be changed in 2.0.0 and will not be compatible with the
10
+ class in versions 1.8.x. This change obsoletes the deprecation announcement in
11
+ 1.8a3 (below).
12
+
13
+ Packaging:
14
+
15
+ Wheels for 1.8.3 published on PyPI include GEOS 3.10.3.
16
+
17
+ Bug fixes:
18
+
19
+ - The signature for GEOSMinimumClearance has been corrected, fixing an issue
20
+ affecting aarch64-darwin (#1480)
21
+ - Return and arg types have been corrected and made more strict for area,
22
+ length, and distance properties.
23
+ - A new c_geom_p type has been created to replace c_void_p when calling GEOS
24
+ functions (#1479).
25
+ - An incorrect polygon-line intersection (#1427) has been fixed in GEOS 3.10.3,
26
+ which will be included in wheels published to PyPI.
27
+ - GEOS buffer parameters are now destroyed, fixing a memory leak (#1440).
28
+
4
29
  1.8.2 (2022-05-03)
5
30
  ------------------
6
31
 
@@ -23,7 +48,7 @@ install from source.
23
48
  Packaging:
24
49
 
25
50
  Wheels for 1.8.1 published on PyPI include GEOS 3.10.2. This version is the
26
- best version of GDAL yet. Discrepancies in behavior compared to previous
51
+ best version of GEOS yet. Discrepancies in behavior compared to previous
27
52
  versions are considered to be improvements.
28
53
 
29
54
  For the first time, we will publish wheels for macos_arm64 (see PR #1310).
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Shapely
3
- Version: 1.8.2
3
+ Version: 1.8.3
4
4
  Summary: Geometric objects, predicates, and operations
5
5
  Home-page: https://github.com/shapely/shapely
6
6
  Author: Sean Gillies
@@ -9,7 +9,6 @@ Maintainer: Sean Gillies
9
9
  Maintainer-email: sean.gillies@gmail.com
10
10
  License: BSD
11
11
  Keywords: geometry topology gis
12
- Platform: UNKNOWN
13
12
  Classifier: Development Status :: 5 - Production/Stable
14
13
  Classifier: Intended Audience :: Developers
15
14
  Classifier: Intended Audience :: Science/Research
@@ -332,6 +331,31 @@ U.S. National Endowment for the Humanities (https://www.neh.gov).
332
331
  Changes
333
332
  =======
334
333
 
334
+ 1.8.3 (2022-08-16)
335
+ ------------------
336
+
337
+ Deprecations:
338
+
339
+ The STRtree class will be changed in 2.0.0 and will not be compatible with the
340
+ class in versions 1.8.x. This change obsoletes the deprecation announcement in
341
+ 1.8a3 (below).
342
+
343
+ Packaging:
344
+
345
+ Wheels for 1.8.3 published on PyPI include GEOS 3.10.3.
346
+
347
+ Bug fixes:
348
+
349
+ - The signature for GEOSMinimumClearance has been corrected, fixing an issue
350
+ affecting aarch64-darwin (#1480)
351
+ - Return and arg types have been corrected and made more strict for area,
352
+ length, and distance properties.
353
+ - A new c_geom_p type has been created to replace c_void_p when calling GEOS
354
+ functions (#1479).
355
+ - An incorrect polygon-line intersection (#1427) has been fixed in GEOS 3.10.3,
356
+ which will be included in wheels published to PyPI.
357
+ - GEOS buffer parameters are now destroyed, fixing a memory leak (#1440).
358
+
335
359
  1.8.2 (2022-05-03)
336
360
  ------------------
337
361
 
@@ -354,7 +378,7 @@ install from source.
354
378
  Packaging:
355
379
 
356
380
  Wheels for 1.8.1 published on PyPI include GEOS 3.10.2. This version is the
357
- best version of GDAL yet. Discrepancies in behavior compared to previous
381
+ best version of GEOS yet. Discrepancies in behavior compared to previous
358
382
  versions are considered to be improvements.
359
383
 
360
384
  For the first time, we will publish wheels for macos_arm64 (see PR #1310).
@@ -1224,5 +1248,3 @@ TODO: fill gap here
1224
1248
  1.0 RC1 (2008-01-14)
1225
1249
  --------------------
1226
1250
  - First release candidate
1227
-
1228
-
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Shapely
3
- Version: 1.8.2
3
+ Version: 1.8.3
4
4
  Summary: Geometric objects, predicates, and operations
5
5
  Home-page: https://github.com/shapely/shapely
6
6
  Author: Sean Gillies
@@ -9,7 +9,6 @@ Maintainer: Sean Gillies
9
9
  Maintainer-email: sean.gillies@gmail.com
10
10
  License: BSD
11
11
  Keywords: geometry topology gis
12
- Platform: UNKNOWN
13
12
  Classifier: Development Status :: 5 - Production/Stable
14
13
  Classifier: Intended Audience :: Developers
15
14
  Classifier: Intended Audience :: Science/Research
@@ -332,6 +331,31 @@ U.S. National Endowment for the Humanities (https://www.neh.gov).
332
331
  Changes
333
332
  =======
334
333
 
334
+ 1.8.3 (2022-08-16)
335
+ ------------------
336
+
337
+ Deprecations:
338
+
339
+ The STRtree class will be changed in 2.0.0 and will not be compatible with the
340
+ class in versions 1.8.x. This change obsoletes the deprecation announcement in
341
+ 1.8a3 (below).
342
+
343
+ Packaging:
344
+
345
+ Wheels for 1.8.3 published on PyPI include GEOS 3.10.3.
346
+
347
+ Bug fixes:
348
+
349
+ - The signature for GEOSMinimumClearance has been corrected, fixing an issue
350
+ affecting aarch64-darwin (#1480)
351
+ - Return and arg types have been corrected and made more strict for area,
352
+ length, and distance properties.
353
+ - A new c_geom_p type has been created to replace c_void_p when calling GEOS
354
+ functions (#1479).
355
+ - An incorrect polygon-line intersection (#1427) has been fixed in GEOS 3.10.3,
356
+ which will be included in wheels published to PyPI.
357
+ - GEOS buffer parameters are now destroyed, fixing a memory leak (#1440).
358
+
335
359
  1.8.2 (2022-05-03)
336
360
  ------------------
337
361
 
@@ -354,7 +378,7 @@ install from source.
354
378
  Packaging:
355
379
 
356
380
  Wheels for 1.8.1 published on PyPI include GEOS 3.10.2. This version is the
357
- best version of GDAL yet. Discrepancies in behavior compared to previous
381
+ best version of GEOS yet. Discrepancies in behavior compared to previous
358
382
  versions are considered to be improvements.
359
383
 
360
384
  For the first time, we will publish wheels for macos_arm64 (see PR #1310).
@@ -1224,5 +1248,3 @@ TODO: fill gap here
1224
1248
  1.0 RC1 (2008-01-14)
1225
1249
  --------------------
1226
1250
  - First release candidate
1227
-
1228
-
@@ -0,0 +1 @@
1
+ 1.8.3
@@ -0,0 +1,6 @@
1
+ [build-system]
2
+ requires = [
3
+ "Cython>=0.29.24,<3",
4
+ "oldest-supported-numpy",
5
+ "setuptools<64",
6
+ ]
@@ -0,0 +1 @@
1
+ __version__ = "1.8.3"
@@ -3,8 +3,19 @@
3
3
  See header file: geos-x.y.z/capi/geos_c.h
4
4
  '''
5
5
 
6
- from ctypes import CFUNCTYPE, POINTER, c_void_p, c_char_p, \
7
- c_size_t, c_byte, c_uint, c_int, c_double, py_object
6
+ from ctypes import (
7
+ CFUNCTYPE,
8
+ POINTER,
9
+ Structure,
10
+ c_void_p,
11
+ c_char_p,
12
+ c_size_t,
13
+ c_byte,
14
+ c_uint,
15
+ c_int,
16
+ c_double,
17
+ py_object,
18
+ )
8
19
 
9
20
  from .errors import UnsupportedGEOSVersionError
10
21
 
@@ -20,6 +31,13 @@ class allocated_c_char_p(c_char_p):
20
31
  pass
21
32
 
22
33
 
34
+ class GEOSGeom_t(Structure):
35
+ pass
36
+
37
+
38
+ c_geom_p = POINTER(GEOSGeom_t)
39
+
40
+
23
41
  def prototype(lgeos, geos_version):
24
42
  """Protype functions in geos_c.h for different version of GEOS
25
43
 
@@ -132,6 +150,9 @@ def prototype(lgeos, geos_version):
132
150
  lgeos.GEOSBufferParams_create.restype = c_void_p
133
151
  lgeos.GEOSBufferParams_create.argtypes = None
134
152
 
153
+ lgeos.GEOSBufferParams_destroy.restype = None
154
+ lgeos.GEOSBufferParams_destroy.argtypes = [c_void_p]
155
+
135
156
  lgeos.GEOSBufferParams_setEndCapStyle.restype = c_int
136
157
  lgeos.GEOSBufferParams_setEndCapStyle.argtypes = [c_void_p, c_int]
137
158
 
@@ -152,25 +173,25 @@ def prototype(lgeos, geos_version):
152
173
 
153
174
  # Geometry constructors
154
175
 
155
- lgeos.GEOSGeom_createPoint.restype = c_void_p
176
+ lgeos.GEOSGeom_createPoint.restype = c_geom_p
156
177
  lgeos.GEOSGeom_createPoint.argtypes = [c_void_p]
157
178
 
158
- lgeos.GEOSGeom_createLinearRing.restype = c_void_p
179
+ lgeos.GEOSGeom_createLinearRing.restype = c_geom_p
159
180
  lgeos.GEOSGeom_createLinearRing.argtypes = [c_void_p]
160
181
 
161
- lgeos.GEOSGeom_createLineString.restype = c_void_p
182
+ lgeos.GEOSGeom_createLineString.restype = c_geom_p
162
183
  lgeos.GEOSGeom_createLineString.argtypes = [c_void_p]
163
184
 
164
- lgeos.GEOSGeom_createPolygon.restype = c_void_p
165
- lgeos.GEOSGeom_createPolygon.argtypes = [c_void_p, c_void_p, c_uint]
185
+ lgeos.GEOSGeom_createPolygon.restype = c_geom_p
186
+ lgeos.GEOSGeom_createPolygon.argtypes = [c_geom_p, POINTER(c_geom_p), c_uint]
166
187
 
167
- lgeos.GEOSGeom_createCollection.restype = c_void_p
168
- lgeos.GEOSGeom_createCollection.argtypes = [c_int, c_void_p, c_uint]
188
+ lgeos.GEOSGeom_createCollection.restype = c_geom_p
189
+ lgeos.GEOSGeom_createCollection.argtypes = [c_int, POINTER(c_geom_p), c_uint]
169
190
 
170
- lgeos.GEOSGeom_createEmptyCollection.restype = c_void_p
191
+ lgeos.GEOSGeom_createEmptyCollection.restype = c_geom_p
171
192
  lgeos.GEOSGeom_createEmptyCollection.argtypes = [c_int]
172
193
 
173
- lgeos.GEOSGeom_clone.restype = c_void_p
194
+ lgeos.GEOSGeom_clone.restype = c_geom_p
174
195
  lgeos.GEOSGeom_clone.argtypes = [c_void_p]
175
196
 
176
197
  # Memory management
@@ -222,9 +243,13 @@ def prototype(lgeos, geos_version):
222
243
  lgeos.GEOSPolygonize.restype = c_void_p
223
244
  lgeos.GEOSPolygonize.argtypes = [c_void_p, c_uint]
224
245
 
225
- lgeos.GEOSPolygonize_full.restype = c_void_p
246
+ lgeos.GEOSPolygonize_full.restype = c_geom_p
226
247
  lgeos.GEOSPolygonize_full.argtypes = [
227
- c_void_p, c_void_p, c_void_p, c_void_p]
248
+ c_geom_p,
249
+ POINTER(c_geom_p),
250
+ POINTER(c_geom_p),
251
+ POINTER(c_geom_p),
252
+ ]
228
253
 
229
254
  if geos_version >= (3, 4, 0):
230
255
  lgeos.GEOSDelaunayTriangulation.restype = c_void_p
@@ -393,17 +418,17 @@ def prototype(lgeos, geos_version):
393
418
 
394
419
  # Misc functions
395
420
 
396
- lgeos.GEOSArea.restype = c_double
397
- lgeos.GEOSArea.argtypes = [c_void_p, c_void_p]
421
+ lgeos.GEOSArea.restype = c_int
422
+ lgeos.GEOSArea.argtypes = [c_geom_p, POINTER(c_double)]
398
423
 
399
424
  lgeos.GEOSLength.restype = c_int
400
- lgeos.GEOSLength.argtypes = [c_void_p, c_void_p]
425
+ lgeos.GEOSLength.argtypes = [c_geom_p, POINTER(c_double)]
401
426
 
402
427
  lgeos.GEOSDistance.restype = c_int
403
- lgeos.GEOSDistance.argtypes = [c_void_p, c_void_p, c_void_p]
428
+ lgeos.GEOSDistance.argtypes = [c_geom_p, c_geom_p, POINTER(c_double)]
404
429
 
405
430
  lgeos.GEOSHausdorffDistance.restype = c_int
406
- lgeos.GEOSHausdorffDistance.argtypes = [c_void_p, c_void_p, c_void_p]
431
+ lgeos.GEOSHausdorffDistance.argtypes = [c_geom_p, c_geom_p, POINTER(c_double)]
407
432
 
408
433
  # Reader and Writer APIs
409
434
 
@@ -521,8 +546,8 @@ def prototype(lgeos, geos_version):
521
546
  c_void_p, py_object, c_void_p, lgeos.GEOSDistanceCallback, py_object]
522
547
  lgeos.GEOSSTRtree_nearest_generic.restype = c_void_p
523
548
 
524
- lgeos.GEOSMinimumClearance.argtypes = [c_void_p]
525
- lgeos.GEOSMinimumClearance.restype = c_double
549
+ lgeos.GEOSMinimumClearance.argtypes = [c_geom_p, POINTER(c_double)]
550
+ lgeos.GEOSMinimumClearance.restype = c_int
526
551
 
527
552
  if geos_version >= (3, 8, 0):
528
553
  lgeos.GEOSMakeValid.restype = c_void_p
@@ -7,7 +7,7 @@ different z values may intersect or be equal.
7
7
  """
8
8
 
9
9
  from binascii import a2b_hex
10
- from ctypes import pointer, c_size_t, c_char_p, c_void_p
10
+ from ctypes import cast, pointer, c_size_t, c_char_p, c_void_p
11
11
  from itertools import islice
12
12
  import logging
13
13
  import math
@@ -18,6 +18,7 @@ import warnings
18
18
 
19
19
  from shapely.affinity import affine_transform
20
20
  from shapely.coords import CoordinateSequence
21
+ from shapely.ctypes_declarations import c_geom_p
21
22
  from shapely.errors import GeometryTypeError, WKBReadingError, WKTReadingError
22
23
  from shapely.errors import ShapelyDeprecationWarning
23
24
  from shapely.geos import WKBWriter, WKTWriter
@@ -107,10 +108,11 @@ def geos_geom_from_py(ob, create_func=None):
107
108
  This behaviour is useful for converting between LineString and LinearRing
108
109
  objects.
109
110
  """
111
+ geom_ptr = cast(ob._geom, c_geom_p)
110
112
  if create_func is None:
111
- geom = lgeos.GEOSGeom_clone(ob._geom)
113
+ geom = lgeos.GEOSGeom_clone(geom_ptr)
112
114
  else:
113
- cs = lgeos.GEOSGeom_getCoordSeq(ob._geom)
115
+ cs = lgeos.GEOSGeom_getCoordSeq(geom_ptr)
114
116
  cs = lgeos.GEOSCoordSeq_clone(cs)
115
117
  geom = create_func(cs)
116
118
 
@@ -625,12 +627,16 @@ class BaseGeometry:
625
627
 
626
628
  if 'buffer_with_params' in self.impl:
627
629
  params = self._lgeos.GEOSBufferParams_create()
628
- self._lgeos.GEOSBufferParams_setEndCapStyle(params, cap_style)
629
- self._lgeos.GEOSBufferParams_setJoinStyle(params, join_style)
630
- self._lgeos.GEOSBufferParams_setMitreLimit(params, mitre_limit)
631
- self._lgeos.GEOSBufferParams_setQuadrantSegments(params, res)
632
- self._lgeos.GEOSBufferParams_setSingleSided(params, single_sided)
633
- return geom_factory(self.impl['buffer_with_params'](self, params, distance))
630
+ try:
631
+ self._lgeos.GEOSBufferParams_setEndCapStyle(params, cap_style)
632
+ self._lgeos.GEOSBufferParams_setJoinStyle(params, join_style)
633
+ self._lgeos.GEOSBufferParams_setMitreLimit(params, mitre_limit)
634
+ self._lgeos.GEOSBufferParams_setQuadrantSegments(params, res)
635
+ self._lgeos.GEOSBufferParams_setSingleSided(params, single_sided)
636
+ return geom_factory(self.impl['buffer_with_params'](self, params, distance))
637
+ finally:
638
+ if params:
639
+ self._lgeos.GEOSBufferParams_destroy(params)
634
640
 
635
641
  if cap_style == CAP_STYLE.round and join_style == JOIN_STYLE.round:
636
642
  return geom_factory(self.impl['buffer'](self, distance, res))
@@ -3,6 +3,7 @@
3
3
 
4
4
  from ctypes import c_void_p
5
5
 
6
+ from shapely.ctypes_declarations import c_geom_p
6
7
  from shapely.geos import lgeos
7
8
  from shapely.geometry.base import BaseGeometry
8
9
  from shapely.geometry.base import BaseMultipartGeometry
@@ -63,7 +64,7 @@ def geos_geometrycollection_from_py(ob):
63
64
  ob = ob.geoms
64
65
  L = len(ob)
65
66
  N = 2
66
- subs = (c_void_p * L)()
67
+ subs = (c_geom_p * L)()
67
68
  for l in range(L):
68
69
  assert(isinstance(ob[l], BaseGeometry))
69
70
  if ob[l].has_z:
@@ -4,6 +4,7 @@
4
4
  from ctypes import c_void_p, cast
5
5
  import warnings
6
6
 
7
+ from shapely.ctypes_declarations import c_geom_p
7
8
  from shapely.errors import EmptyPartError, ShapelyDeprecationWarning
8
9
  from shapely.geos import lgeos
9
10
  from shapely.geometry.base import BaseMultipartGeometry, geos_geom_from_py
@@ -116,9 +117,9 @@ def asMultiLineString(context):
116
117
 
117
118
 
118
119
  def geos_multilinestring_from_py(ob):
119
- # ob must be either a MultiLineString, a sequence, or
120
+ # ob must be either a MultiLineString, a sequence, or
120
121
  # array of sequences or arrays
121
-
122
+
122
123
  if isinstance(ob, MultiLineString):
123
124
  return geos_geom_from_py(ob)
124
125
 
@@ -134,8 +135,8 @@ def geos_multilinestring_from_py(ob):
134
135
  raise ValueError("Invalid coordinate dimensionality")
135
136
 
136
137
  # Array of pointers to point geometries
137
- subs = (c_void_p * L)()
138
-
138
+ subs = (c_geom_p * L)()
139
+
139
140
  # add to coordinate sequence
140
141
  for l in range(L):
141
142
  geom, ndims = linestring.geos_linestring_from_py(obs[l])
@@ -143,6 +144,6 @@ def geos_multilinestring_from_py(ob):
143
144
  if lgeos.GEOSisEmpty(geom):
144
145
  raise EmptyPartError("Can't create MultiLineString with empty component")
145
146
 
146
- subs[l] = cast(geom, c_void_p)
147
-
147
+ subs[l] = cast(geom, c_geom_p)
148
+
148
149
  return (lgeos.GEOSGeom_createCollection(5, subs, L), N)
@@ -4,6 +4,7 @@
4
4
  from ctypes import byref, c_double, c_void_p, cast
5
5
  import warnings
6
6
 
7
+ from shapely.ctypes_declarations import c_geom_p
7
8
  from shapely.errors import EmptyPartError, ShapelyDeprecationWarning
8
9
  from shapely.geos import lgeos
9
10
  from shapely.geometry.base import (
@@ -194,7 +195,7 @@ def geos_multipoint_from_py(ob):
194
195
  assert n == 2 or n == 3
195
196
 
196
197
  # Array of pointers to point geometries
197
- subs = (c_void_p * m)()
198
+ subs = (c_geom_p * m)()
198
199
 
199
200
  # add to coordinate sequence
200
201
  for i in range(m):
@@ -204,6 +205,6 @@ def geos_multipoint_from_py(ob):
204
205
  if lgeos.GEOSisEmpty(geom):
205
206
  raise EmptyPartError("Can't create MultiPoint with empty component")
206
207
 
207
- subs[i] = cast(geom, c_void_p)
208
+ subs[i] = cast(geom, c_geom_p)
208
209
 
209
210
  return lgeos.GEOSGeom_createCollection(4, subs, m), n
@@ -4,6 +4,7 @@
4
4
  from ctypes import c_void_p, cast
5
5
  import warnings
6
6
 
7
+ from shapely.ctypes_declarations import c_geom_p
7
8
  from shapely.errors import ShapelyDeprecationWarning
8
9
  from shapely.geos import lgeos
9
10
  from shapely.geometry.base import BaseMultipartGeometry, geos_geom_from_py
@@ -146,10 +147,10 @@ def geos_multipolygon_from_py(ob):
146
147
  N = len(ob[0][0][0])
147
148
  assert N == 2 or N == 3
148
149
 
149
- subs = (c_void_p * L)()
150
+ subs = (c_geom_p * L)()
150
151
  for l in range(L):
151
152
  geom, ndims = polygon.geos_polygon_from_py(ob[l][0], ob[l][1:])
152
- subs[l] = cast(geom, c_void_p)
153
+ subs[l] = cast(geom, c_geom_p)
153
154
 
154
155
  return (lgeos.GEOSGeom_createCollection(6, subs, L), N)
155
156
 
@@ -192,7 +193,7 @@ def geos_multipolygon_from_polygons(arg):
192
193
 
193
194
  assert N == 2 or N == 3
194
195
 
195
- subs = (c_void_p * L)()
196
+ subs = (c_geom_p * L)()
196
197
 
197
198
  for i, ob in enumerate(obs):
198
199
  if isinstance(ob, polygon.Polygon):
@@ -203,6 +204,6 @@ def geos_multipolygon_from_polygons(arg):
203
204
  holes = ob[1]
204
205
 
205
206
  geom, ndims = polygon.geos_polygon_from_py(shell, holes)
206
- subs[i] = cast(geom, c_void_p)
207
+ subs[i] = cast(geom, c_geom_p)
207
208
 
208
209
  return (lgeos.GEOSGeom_createCollection(6, subs, L), N)
@@ -9,6 +9,7 @@ import weakref
9
9
 
10
10
  from shapely.algorithms.cga import signed_area
11
11
  from shapely.coords import CoordinateSequence
12
+ from shapely.ctypes_declarations import c_geom_p
12
13
  from shapely.geos import lgeos
13
14
  from shapely.geometry.base import BaseGeometry, geos_geom_from_py
14
15
  from shapely.geometry.linestring import LineString, LineStringAdapter
@@ -555,16 +556,17 @@ def geos_polygon_from_py(shell, holes=None):
555
556
  raise ValueError("insufficiant coordinate dimension")
556
557
 
557
558
  # Array of pointers to ring geometries
558
- geos_holes = (c_void_p * L)()
559
+ geos_holes = (c_geom_p * L)()
559
560
 
560
561
  # add to coordinate sequence
561
562
  for l in range(L):
562
563
  geom, ndim = geos_linearring_from_py(ob[l])
563
- geos_holes[l] = cast(geom, c_void_p)
564
+ geos_holes[l] = cast(geom, c_geom_p)
564
565
  else:
565
- geos_holes = POINTER(c_void_p)()
566
+ geos_holes = POINTER(c_geom_p)()
566
567
  L = 0
567
568
 
568
569
  return (
569
- lgeos.GEOSGeom_createPolygon(
570
- c_void_p(geos_shell), geos_holes, L), ndim)
570
+ lgeos.GEOSGeom_createPolygon(cast(geos_shell, c_geom_p), geos_holes, L),
571
+ ndim,
572
+ )
@@ -34,14 +34,17 @@ class CachingGeometryProxy:
34
34
  self.__geom__, n = self.factory(self.context)
35
35
  self._gtag = gtag
36
36
  return self.__geom__
37
-
37
+
38
38
  def gtag(self):
39
39
  return hash(repr(self.context))
40
40
 
41
41
  def __setattr__(self, name, value):
42
42
  # to override the custom one in BaseGeometry, so we don't warn
43
43
  # for the proxy classes, which are already deprecated itself
44
- object.__setattr__(self, name, value)
44
+ try:
45
+ object.__setattr__(self, name, value)
46
+ except AttributeError:
47
+ pass
45
48
 
46
49
 
47
50
  class PolygonProxy(CachingGeometryProxy):
@@ -1,9 +1,10 @@
1
1
  """Support for various GEOS geometry operations
2
2
  """
3
3
 
4
- from ctypes import byref, c_void_p, c_double
4
+ from ctypes import byref, cast, c_void_p, c_double
5
5
  from warnings import warn
6
6
 
7
+ from shapely.ctypes_declarations import c_geom_p
7
8
  from shapely.errors import GeometryTypeError, ShapelyDeprecationWarning
8
9
  from shapely.prepared import prep
9
10
  from shapely.geos import lgeos
@@ -44,12 +45,16 @@ class CollectionOperator:
44
45
  source = [source]
45
46
  finally:
46
47
  obs = [self.shapeup(l) for l in source]
47
- geom_array_type = c_void_p * len(obs)
48
+
49
+ geom_array_type = c_geom_p * len(obs)
48
50
  geom_array = geom_array_type()
51
+
49
52
  for i, line in enumerate(obs):
50
- geom_array[i] = line._geom
53
+ geom_array[i] = cast(line._geom, c_geom_p)
54
+
51
55
  product = lgeos.GEOSPolygonize(byref(geom_array), len(obs))
52
56
  collection = geom_factory(product)
57
+
53
58
  for g in collection.geoms:
54
59
  clone = lgeos.GEOSGeom_clone(g._geom)
55
60
  g = geom_factory(clone)
@@ -78,16 +83,21 @@ class CollectionOperator:
78
83
  source = [source]
79
84
  finally:
80
85
  obs = [self.shapeup(l) for l in source]
86
+
81
87
  L = len(obs)
82
- subs = (c_void_p * L)()
88
+ subs = (c_geom_p * L)()
89
+
83
90
  for i, g in enumerate(obs):
84
- subs[i] = g._geom
91
+ subs[i] = cast(g._geom, c_geom_p)
92
+
85
93
  collection = lgeos.GEOSGeom_createCollection(5, subs, L)
86
- dangles = c_void_p()
87
- cuts = c_void_p()
88
- invalids = c_void_p()
94
+ dangles = c_geom_p()
95
+ cuts = c_geom_p()
96
+ invalids = c_geom_p()
89
97
  product = lgeos.GEOSPolygonize_full(
90
- collection, byref(dangles), byref(cuts), byref(invalids))
98
+ collection, byref(dangles), byref(cuts), byref(invalids)
99
+ )
100
+
91
101
  return (
92
102
  geom_factory(product),
93
103
  geom_factory(dangles),
@@ -135,9 +145,12 @@ class CollectionOperator:
135
145
  except TypeError:
136
146
  geoms = [geoms]
137
147
  L = 1
138
- subs = (c_void_p * L)()
148
+
149
+ subs = (c_geom_p * L)()
150
+
139
151
  for i, g in enumerate(geoms):
140
- subs[i] = g._geom
152
+ subs[i] = cast(g._geom, c_geom_p)
153
+
141
154
  collection = lgeos.GEOSGeom_createCollection(6, subs, L)
142
155
  return geom_factory(lgeos.methods['cascaded_union'](collection))
143
156
 
@@ -154,9 +167,12 @@ class CollectionOperator:
154
167
  except TypeError:
155
168
  geoms = [geoms]
156
169
  L = 1
157
- subs = (c_void_p * L)()
170
+
171
+ subs = (c_geom_p * L)()
172
+
158
173
  for i, g in enumerate(geoms):
159
- subs[i] = g._geom
174
+ subs[i] = cast(g._geom, c_geom_p)
175
+
160
176
  collection = lgeos.GEOSGeom_createCollection(6, subs, L)
161
177
  return geom_factory(lgeos.methods['unary_union'](collection))
162
178
 
@@ -22,7 +22,10 @@ import ctypes
22
22
  import logging
23
23
  from typing import Any, ItemsView, Iterable, Iterator, Optional, Sequence, Tuple, Union
24
24
  import sys
25
+ from warnings import warn
25
26
 
27
+ from shapely.ctypes_declarations import c_geom_p
28
+ from shapely.errors import ShapelyDeprecationWarning
26
29
  from shapely.geometry.base import BaseGeometry
27
30
  from shapely.geos import lgeos
28
31
 
@@ -97,6 +100,19 @@ class STRtree:
97
100
  items: Iterable[Any] = None,
98
101
  node_capacity: int = 10,
99
102
  ):
103
+ if items is not None:
104
+ warn(
105
+ "STRtree will be changed in 2.0.0 and will not be compatible with versions < 2. "
106
+ "Specifically: the items keyword argument will be removed.",
107
+ ShapelyDeprecationWarning,
108
+ stacklevel=2,
109
+ )
110
+ else:
111
+ warn(
112
+ "STRtree will be changed in 2.0.0 and will not be compatible with versions < 2.",
113
+ ShapelyDeprecationWarning,
114
+ stacklevel=2,
115
+ )
100
116
  self.node_capacity = node_capacity
101
117
 
102
118
  # Keep references to geoms
@@ -247,8 +263,11 @@ class STRtree:
247
263
  if callback_userdata["exclusive"] and self._geoms[idx].equals(geom2):
248
264
  dist[0] = sys.float_info.max
249
265
  else:
250
- lgeos.GEOSDistance(self._geoms[idx]._geom, geom2._geom, dist)
251
-
266
+ lgeos.GEOSDistance(
267
+ ctypes.cast(self._geoms[idx]._geom, c_geom_p),
268
+ ctypes.cast(geom2._geom, c_geom_p),
269
+ dist,
270
+ )
252
271
  return 1
253
272
  except Exception:
254
273
  log.exception("Caught exception")