shapely 1.6a1__tar.gz → 1.6a2__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 (139) hide show
  1. {Shapely-1.6a1 → Shapely-1.6a2}/CHANGES.txt +20 -1
  2. {Shapely-1.6a1/Shapely.egg-info → Shapely-1.6a2}/PKG-INFO +21 -2
  3. {Shapely-1.6a1 → Shapely-1.6a2/Shapely.egg-info}/PKG-INFO +21 -2
  4. {Shapely-1.6a1 → Shapely-1.6a2}/Shapely.egg-info/SOURCES.txt +1 -0
  5. Shapely-1.6a2/VERSION.txt +1 -0
  6. {Shapely-1.6a1 → Shapely-1.6a2}/setup.py +21 -8
  7. Shapely-1.6a2/shapely/__init__.py +1 -0
  8. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/ctypes_declarations.py +4 -1
  9. Shapely-1.6a2/shapely/errors.py +33 -0
  10. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/geometry/base.py +4 -3
  11. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/geometry/point.py +2 -1
  12. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/geos.py +23 -35
  13. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/speedups/_speedups.c +777 -225
  14. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_dlls.py +3 -0
  15. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_geos_err_handler.py +1 -1
  16. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_point.py +1 -1
  17. Shapely-1.6a1/VERSION.txt +0 -1
  18. Shapely-1.6a1/shapely/__init__.py +0 -1
  19. {Shapely-1.6a1 → Shapely-1.6a2}/CREDITS.txt +0 -0
  20. {Shapely-1.6a1 → Shapely-1.6a2}/LICENSE.txt +0 -0
  21. {Shapely-1.6a1 → Shapely-1.6a2}/README.rst +0 -0
  22. {Shapely-1.6a1 → Shapely-1.6a2}/Shapely.egg-info/dependency_links.txt +0 -0
  23. {Shapely-1.6a1 → Shapely-1.6a2}/Shapely.egg-info/requires.txt +0 -0
  24. {Shapely-1.6a1 → Shapely-1.6a2}/Shapely.egg-info/top_level.txt +0 -0
  25. {Shapely-1.6a1 → Shapely-1.6a2}/docs/design.rst +0 -0
  26. {Shapely-1.6a1 → Shapely-1.6a2}/docs/index.rst +0 -0
  27. {Shapely-1.6a1 → Shapely-1.6a2}/docs/manual.rst +0 -0
  28. {Shapely-1.6a1 → Shapely-1.6a2}/docs/project.rst +0 -0
  29. {Shapely-1.6a1 → Shapely-1.6a2}/packaging/__about__.py +0 -0
  30. {Shapely-1.6a1 → Shapely-1.6a2}/packaging/__init__.py +0 -0
  31. {Shapely-1.6a1 → Shapely-1.6a2}/packaging/_compat.py +0 -0
  32. {Shapely-1.6a1 → Shapely-1.6a2}/packaging/_structures.py +0 -0
  33. {Shapely-1.6a1 → Shapely-1.6a2}/packaging/markers.py +0 -0
  34. {Shapely-1.6a1 → Shapely-1.6a2}/packaging/requirements.py +0 -0
  35. {Shapely-1.6a1 → Shapely-1.6a2}/packaging/specifiers.py +0 -0
  36. {Shapely-1.6a1 → Shapely-1.6a2}/packaging/utils.py +0 -0
  37. {Shapely-1.6a1 → Shapely-1.6a2}/packaging/version.py +0 -0
  38. {Shapely-1.6a1 → Shapely-1.6a2}/packaging-15.3.dist-info/DESCRIPTION.rst +0 -0
  39. {Shapely-1.6a1 → Shapely-1.6a2}/packaging-15.3.dist-info/METADATA +0 -0
  40. {Shapely-1.6a1 → Shapely-1.6a2}/packaging-15.3.dist-info/RECORD +0 -0
  41. {Shapely-1.6a1 → Shapely-1.6a2}/packaging-15.3.dist-info/WHEEL +0 -0
  42. {Shapely-1.6a1 → Shapely-1.6a2}/packaging-15.3.dist-info/metadata.json +0 -0
  43. {Shapely-1.6a1 → Shapely-1.6a2}/packaging-15.3.dist-info/pbr.json +0 -0
  44. {Shapely-1.6a1 → Shapely-1.6a2}/packaging-15.3.dist-info/top_level.txt +0 -0
  45. {Shapely-1.6a1 → Shapely-1.6a2}/setup.cfg +1 -1
  46. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/_buildcfg.py +0 -0
  47. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/_geos.pxi +0 -0
  48. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/affinity.py +0 -0
  49. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/algorithms/__init__.py +0 -0
  50. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/algorithms/cga.py +0 -0
  51. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/algorithms/polylabel.py +0 -0
  52. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/coords.py +0 -0
  53. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/examples/__init__.py +0 -0
  54. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/examples/dissolve.py +0 -0
  55. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/examples/geoms.py +0 -0
  56. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/examples/intersect.py +0 -0
  57. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/ftools.py +0 -0
  58. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/geometry/__init__.py +0 -0
  59. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/geometry/collection.py +0 -0
  60. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/geometry/geo.py +0 -0
  61. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/geometry/linestring.py +0 -0
  62. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/geometry/multilinestring.py +0 -0
  63. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/geometry/multipoint.py +0 -0
  64. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/geometry/multipolygon.py +0 -0
  65. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/geometry/polygon.py +0 -0
  66. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/geometry/proxy.py +0 -0
  67. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/impl.py +0 -0
  68. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/iterops.py +0 -0
  69. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/linref.py +0 -0
  70. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/ops.py +0 -0
  71. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/predicates.py +0 -0
  72. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/prepared.py +0 -0
  73. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/speedups/__init__.py +0 -0
  74. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/speedups/_speedups.pyx +0 -0
  75. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/strtree.py +0 -0
  76. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/topology.py +0 -0
  77. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/validation.py +0 -0
  78. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/vectorized/__init__.py +0 -0
  79. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/vectorized/_vectorized.pyx +0 -0
  80. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/wkb.py +0 -0
  81. {Shapely-1.6a1 → Shapely-1.6a2}/shapely/wkt.py +0 -0
  82. {Shapely-1.6a1 → Shapely-1.6a2}/tests/__init__.py +0 -0
  83. {Shapely-1.6a1 → Shapely-1.6a2}/tests/binascii_hex.txt +0 -0
  84. {Shapely-1.6a1 → Shapely-1.6a2}/tests/conftest.py +0 -0
  85. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_affinity.py +0 -0
  86. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_box.py +0 -0
  87. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_cga.py +0 -0
  88. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_collection.py +0 -0
  89. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_coords.py +0 -0
  90. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_default_impl.py +0 -0
  91. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_delaunay.py +0 -0
  92. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_delegated.py +0 -0
  93. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_doctests.py +0 -0
  94. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_emptiness.py +0 -0
  95. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_empty_polygons.py +0 -0
  96. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_equality.py +0 -0
  97. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_geointerface.py +0 -0
  98. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_geomseq.py +0 -0
  99. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_getitem.py +0 -0
  100. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_hash.py +0 -0
  101. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_invalid_geometries.py +0 -0
  102. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_iterops.py +0 -0
  103. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_linear_referencing.py +0 -0
  104. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_linemerge.py +0 -0
  105. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_linestring.py +0 -0
  106. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_locale.py +0 -0
  107. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_mapping.py +0 -0
  108. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_minimum_rotated_rectangle.py +0 -0
  109. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_multi.py +0 -0
  110. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_multilinestring.py +0 -0
  111. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_multipoint.py +0 -0
  112. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_multipolygon.py +0 -0
  113. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_ndarrays.py +0 -0
  114. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_nearest.py +0 -0
  115. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_operations.py +0 -0
  116. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_operators.py +0 -0
  117. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_parallel_offset.py +0 -0
  118. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_persist.py +0 -0
  119. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_pickle.py +0 -0
  120. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_polygon.py +0 -0
  121. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_polygonize.py +0 -0
  122. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_polylabel.py +0 -0
  123. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_predicates.py +0 -0
  124. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_prepared.py +0 -0
  125. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_products_z.py +0 -0
  126. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_shared_paths.py +0 -0
  127. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_singularity.py +0 -0
  128. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_snap.py +0 -0
  129. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_split.py +0 -0
  130. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_strtree.py +0 -0
  131. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_styles.py +0 -0
  132. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_svg.py +0 -0
  133. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_transform.py +0 -0
  134. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_union.py +0 -0
  135. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_validation.py +0 -0
  136. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_vectorized.py +0 -0
  137. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_wkt.py +0 -0
  138. {Shapely-1.6a1 → Shapely-1.6a2}/tests/test_xy.py +0 -0
  139. {Shapely-1.6a1 → Shapely-1.6a2}/tests/threading_test.py +0 -0
@@ -1,6 +1,25 @@
1
1
  Changes
2
2
  =======
3
3
 
4
+ 1.6a2 (2016-11-09)
5
+ ------------------
6
+
7
+ Bug fixes:
8
+
9
+ - Shapely no longer configures logging in ``geos.py`` (#415).
10
+
11
+ Refactoring:
12
+
13
+ - Consolidation of exceptions in ``shapely.errors``.
14
+ - ``UnsupportedGEOSVersionError`` is raised when GEOS < 3.3.0 (#407).
15
+
16
+ Packaging:
17
+
18
+ - Added new library search paths to assist Anaconda (#413).
19
+ - geos-config will now be bypassed when NO_GEOS_CONFIG env var is set. This
20
+ allows configuration of Shapely builds on Linux systems that for whatever
21
+ reasons do not include the geos-config program (#322).
22
+
4
23
  1.6a1 (2016-09-14)
5
24
  ------------------
6
25
 
@@ -27,7 +46,7 @@ Refactoring:
27
46
 
28
47
  - Switch from ``SingleSidedBuffer()`` to ``OffsetCurve()`` for GEOS >= 3.3
29
48
  (#270).
30
- - Cython speedups are now enabled by defualt (#252).
49
+ - Cython speedups are now enabled by default (#252).
31
50
 
32
51
  Packaging:
33
52
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: Shapely
3
- Version: 1.6a1
3
+ Version: 1.6a2
4
4
  Summary: Geometric objects, predicates, and operations
5
5
  Home-page: https://github.com/Toblerity/Shapely
6
6
  Author: Sean Gillies
@@ -231,6 +231,25 @@ Description: =======
231
231
  Changes
232
232
  =======
233
233
 
234
+ 1.6a2 (2016-11-09)
235
+ ------------------
236
+
237
+ Bug fixes:
238
+
239
+ - Shapely no longer configures logging in ``geos.py`` (#415).
240
+
241
+ Refactoring:
242
+
243
+ - Consolidation of exceptions in ``shapely.errors``.
244
+ - ``UnsupportedGEOSVersionError`` is raised when GEOS < 3.3.0 (#407).
245
+
246
+ Packaging:
247
+
248
+ - Added new library search paths to assist Anaconda (#413).
249
+ - geos-config will now be bypassed when NO_GEOS_CONFIG env var is set. This
250
+ allows configuration of Shapely builds on Linux systems that for whatever
251
+ reasons do not include the geos-config program (#322).
252
+
234
253
  1.6a1 (2016-09-14)
235
254
  ------------------
236
255
 
@@ -257,7 +276,7 @@ Description: =======
257
276
 
258
277
  - Switch from ``SingleSidedBuffer()`` to ``OffsetCurve()`` for GEOS >= 3.3
259
278
  (#270).
260
- - Cython speedups are now enabled by defualt (#252).
279
+ - Cython speedups are now enabled by default (#252).
261
280
 
262
281
  Packaging:
263
282
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.1
2
2
  Name: Shapely
3
- Version: 1.6a1
3
+ Version: 1.6a2
4
4
  Summary: Geometric objects, predicates, and operations
5
5
  Home-page: https://github.com/Toblerity/Shapely
6
6
  Author: Sean Gillies
@@ -231,6 +231,25 @@ Description: =======
231
231
  Changes
232
232
  =======
233
233
 
234
+ 1.6a2 (2016-11-09)
235
+ ------------------
236
+
237
+ Bug fixes:
238
+
239
+ - Shapely no longer configures logging in ``geos.py`` (#415).
240
+
241
+ Refactoring:
242
+
243
+ - Consolidation of exceptions in ``shapely.errors``.
244
+ - ``UnsupportedGEOSVersionError`` is raised when GEOS < 3.3.0 (#407).
245
+
246
+ Packaging:
247
+
248
+ - Added new library search paths to assist Anaconda (#413).
249
+ - geos-config will now be bypassed when NO_GEOS_CONFIG env var is set. This
250
+ allows configuration of Shapely builds on Linux systems that for whatever
251
+ reasons do not include the geos-config program (#322).
252
+
234
253
  1.6a1 (2016-09-14)
235
254
  ------------------
236
255
 
@@ -257,7 +276,7 @@ Description: =======
257
276
 
258
277
  - Switch from ``SingleSidedBuffer()`` to ``OffsetCurve()`` for GEOS >= 3.3
259
278
  (#270).
260
- - Cython speedups are now enabled by defualt (#252).
279
+ - Cython speedups are now enabled by default (#252).
261
280
 
262
281
  Packaging:
263
282
 
@@ -36,6 +36,7 @@ shapely/_geos.pxi
36
36
  shapely/affinity.py
37
37
  shapely/coords.py
38
38
  shapely/ctypes_declarations.py
39
+ shapely/errors.py
39
40
  shapely/ftools.py
40
41
  shapely/geos.py
41
42
  shapely/impl.py
@@ -0,0 +1 @@
1
+ 1.6a2
@@ -116,8 +116,7 @@ class GEOSConfig(object):
116
116
  match = re.match(r'(\d+)\.(\d+)\.(\d+)', self.get('--version').strip())
117
117
  return tuple(map(int, match.groups()))
118
118
 
119
-
120
- # Get the version from the shapely module
119
+ # Get the version from the shapely module.
121
120
  shapely_version = None
122
121
  with open('shapely/__init__.py', 'r') as fp:
123
122
  for line in fp:
@@ -129,14 +128,18 @@ with open('shapely/__init__.py', 'r') as fp:
129
128
  if not shapely_version:
130
129
  raise ValueError("Could not determine Shapely's version")
131
130
 
131
+ # Allow GEOS_CONFIG to be bypassed in favor of CFLAGS and LDFLAGS
132
+ # vars set by build environment.
133
+ if os.environ.get('NO_GEOS_CONFIG'):
134
+ geos_config = None
135
+ else:
136
+ geos_config = GEOSConfig(os.environ.get('GEOS_CONFIG', 'geos-config'))
137
+
132
138
  # Fail installation if the GEOS shared library does not meet the minimum
133
139
  # version. We ship it with Shapely for Windows, so no need to check on
134
140
  # that platform.
135
-
136
141
  geos_version = None
137
- geos_config = GEOSConfig(os.environ.get('GEOS_CONFIG', 'geos-config'))
138
-
139
- if not os.environ.get('NO_GEOS_CHECK') or sys.platform == 'win32':
142
+ if geos_config and not os.environ.get('NO_GEOS_CHECK') or sys.platform == 'win32':
140
143
  try:
141
144
  log.info(
142
145
  "Shapely >= 1.3 requires GEOS >= 3.3. "
@@ -174,13 +177,13 @@ with open('CHANGES.txt', 'r', **open_kwds) as fp:
174
177
 
175
178
  long_description = readme + '\n\n' + credits + '\n\n' + changes
176
179
 
177
-
178
180
  extra_reqs = {
179
181
  'test': ['pytest', 'pytest-cov', 'numpy>=1.4.1', 'packaging']
180
182
  }
181
183
  extra_reqs['all'] = list(it.chain.from_iterable(extra_reqs.values()))
182
184
 
183
-
185
+ # Make a dict of setup arguments. Some items will be updated as
186
+ # the script progresses.
184
187
  setup_args = dict(
185
188
  name = 'Shapely',
186
189
  version = str(shapely_version),
@@ -244,6 +247,16 @@ library_dirs = []
244
247
  libraries = []
245
248
  extra_link_args = []
246
249
 
250
+ # If NO_GEOS_CONFIG is set in the environment, geos-config will not
251
+ # be called and CFLAGS and LDFLAGS environment variables must be set
252
+ # instead like
253
+ #
254
+ # CFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib -lgeos_c"
255
+ #
256
+ # Or, equivalently:
257
+ #
258
+ # CFLAGS="$(geos-config --cflags)" LDFLAGS="$(geos-config --clibs)"
259
+
247
260
  if geos_version and geos_config:
248
261
  # Collect other options from GEOS configuration.
249
262
  for item in geos_config.get('--cflags').split():
@@ -0,0 +1 @@
1
+ __version__ = "1.6a2"
@@ -6,6 +6,8 @@ See header file: geos-x.y.z/capi/geos_c.h
6
6
  from ctypes import CFUNCTYPE, POINTER, c_void_p, c_char_p, \
7
7
  c_size_t, c_byte, c_uint, c_int, c_double, py_object
8
8
 
9
+ from .errors import UnsupportedGEOSVersionError
10
+
9
11
 
10
12
  EXCEPTION_HANDLER_FUNCTYPE = CFUNCTYPE(None, c_char_p, c_void_p)
11
13
 
@@ -25,7 +27,8 @@ def prototype(lgeos, geos_version):
25
27
  """
26
28
 
27
29
  if not geos_version >= (3, 3, 0):
28
- raise RuntimeError("Shapely requires GEOS version 3.3.0 or newer.")
30
+ raise UnsupportedGEOSVersionError(
31
+ "Shapely requires GEOS version 3.3.0 or newer.")
29
32
 
30
33
  # Initialization, cleanup, version.
31
34
 
@@ -0,0 +1,33 @@
1
+ """Shapely errors."""
2
+
3
+
4
+ class ShapelyError(Exception):
5
+ """Base error class."""
6
+
7
+
8
+ class UnsupportedGEOSVersionError(ShapelyError):
9
+ """Raised when the system's GEOS library version is unsupported."""
10
+
11
+
12
+ class ReadingError(ShapelyError):
13
+ """A WKT or WKB reading error."""
14
+
15
+
16
+ class WKBReadingError(ReadingError):
17
+ """A WKB reading error."""
18
+
19
+
20
+ class WKTReadingError(ReadingError):
21
+ """A WKT reading error."""
22
+
23
+
24
+ class DimensionError(ShapelyError):
25
+ """An error in the number of coordinate dimensions."""
26
+
27
+
28
+ class TopologicalError(ShapelyError):
29
+ """A geometry is invalid or topologically incorrect."""
30
+
31
+
32
+ class PredicateError(ShapelyError):
33
+ """A geometric predicate has failed to return True/False."""
@@ -15,9 +15,10 @@ from warnings import warn
15
15
 
16
16
  from shapely.affinity import affine_transform
17
17
  from shapely.coords import CoordinateSequence
18
+ from shapely.errors import WKBReadingError, WKTReadingError
18
19
  from shapely.ftools import wraps
19
20
  from shapely.geos import WKBWriter, WKTWriter
20
- from shapely.geos import lgeos, ReadingError
21
+ from shapely.geos import lgeos
21
22
  from shapely.impl import DefaultImplementation, delegated
22
23
 
23
24
 
@@ -100,7 +101,7 @@ def geom_from_wkt(data):
100
101
  data = data.encode('ascii')
101
102
  geom = lgeos.GEOSGeomFromWKT(c_char_p(data))
102
103
  if not geom:
103
- raise ReadingError(
104
+ raise WKTReadingError(
104
105
  "Could not create geometry because of errors while reading input.")
105
106
  return geom_factory(geom)
106
107
 
@@ -116,7 +117,7 @@ def geom_to_wkt(ob):
116
117
  def deserialize_wkb(data):
117
118
  geom = lgeos.GEOSGeomFromWKB_buf(c_char_p(data), c_size_t(len(data)))
118
119
  if not geom:
119
- raise ReadingError(
120
+ raise WKBReadingError(
120
121
  "Could not create geometry because of errors while reading input.")
121
122
  return geom
122
123
 
@@ -5,7 +5,8 @@ from ctypes import c_double
5
5
  from ctypes import cast, POINTER
6
6
 
7
7
  from shapely.coords import required
8
- from shapely.geos import lgeos, DimensionError
8
+ from shapely.errors import DimensionError
9
+ from shapely.geos import lgeos
9
10
  from shapely.geometry.base import BaseGeometry, geos_geom_from_py
10
11
  from shapely.geometry.proxy import CachingGeometryProxy
11
12
 
@@ -14,18 +14,12 @@ import sys
14
14
  import threading
15
15
 
16
16
  from .ctypes_declarations import prototype, EXCEPTION_HANDLER_FUNCTYPE
17
+ from .errors import WKBReadingError, WKTReadingError, TopologicalError, PredicateError
17
18
  from . import ftools
18
19
 
19
20
 
20
21
  # Add message handler to this module's logger
21
22
  LOG = logging.getLogger(__name__)
22
- ch = logging.StreamHandler()
23
- LOG.addHandler(ch)
24
-
25
- if 'all' in sys.warnoptions:
26
- # show GEOS messages in console with: python -W all
27
- LOG.setLevel(logging.DEBUG)
28
-
29
23
 
30
24
  # Find and load the GEOS and C libraries
31
25
  # If this ever gets any longer, we'll break it into separate modules
@@ -72,8 +66,13 @@ if sys.platform.startswith('linux'):
72
66
  _lgeos = CDLL(geos_whl_so[0])
73
67
  LOG.debug("Found GEOS DLL: %r, using it.", _lgeos)
74
68
  else:
75
- _lgeos = load_dll(
76
- 'geos_c', fallbacks=['libgeos_c.so.1', 'libgeos_c.so'])
69
+ alt_paths = [
70
+ 'libgeos_c.so.1',
71
+ 'libgeos_c.so',
72
+ # anaconda
73
+ os.path.join(sys.prefix, "lib", "libgeos_c.so"),
74
+ ]
75
+ _lgeos = load_dll('geos_c', fallbacks=alt_paths)
77
76
  free = load_dll('c').free
78
77
  free.argtypes = [c_void_p]
79
78
  free.restype = None
@@ -102,6 +101,8 @@ elif sys.platform == 'darwin':
102
101
  os.path.join(sys._MEIPASS, 'libgeos_c.1.dylib'))
103
102
  else:
104
103
  alt_paths = [
104
+ # anaconda
105
+ os.path.join(sys.prefix, "lib", "libgeos_c.dylib"),
105
106
  # The Framework build from Kyng Chaos
106
107
  "/Library/Frameworks/GEOS.framework/Versions/Current/GEOS",
107
108
  # macports
@@ -119,13 +120,15 @@ elif sys.platform == 'win32':
119
120
  os.path.join(os.path.dirname(__file__), 'DLLs'))
120
121
  if hasattr(sys, "frozen"):
121
122
  wininst_dlls = os.path.normpath(
122
- os.path.abspath(sys.executable+'../../DLLS'))
123
+ os.path.abspath(sys.executable + '../../DLLS'))
123
124
  else:
124
125
  wininst_dlls = os.path.abspath(os.__file__ + "../../../DLLs")
125
126
  original_path = os.environ['PATH']
126
127
  os.environ['PATH'] = "%s;%s;%s" % \
127
128
  (egg_dlls, wininst_dlls, original_path)
128
- _lgeos = CDLL("geos_c.dll")
129
+ _lgeos = load_dll("geos_c.dll", fallbacks=[
130
+ os.path.join(sys.prefix, "Library", "lib", "geos_c.dll"),
131
+ ])
129
132
  except (ImportError, WindowsError, OSError):
130
133
  raise
131
134
 
@@ -199,24 +202,6 @@ if geos_version >= (3, 1, 0):
199
202
  [EXCEPTION_HANDLER_FUNCTYPE, EXCEPTION_HANDLER_FUNCTYPE]
200
203
  _lgeos.finishGEOS_r.argtypes = [c_void_p]
201
204
 
202
- # Exceptions
203
-
204
-
205
- class ReadingError(Exception):
206
- pass
207
-
208
-
209
- class DimensionError(Exception):
210
- pass
211
-
212
-
213
- class TopologicalError(Exception):
214
- pass
215
-
216
-
217
- class PredicateError(Exception):
218
- pass
219
-
220
205
 
221
206
  def handler(level):
222
207
  """Error handler
@@ -275,8 +260,9 @@ class WKTReader(object):
275
260
  text = text.encode('ascii')
276
261
  geom = self._lgeos.GEOSWKTReader_read(self._reader, c_char_p(text))
277
262
  if not geom:
278
- raise ReadingError("Could not create geometry because of errors "
279
- "while reading input.")
263
+ raise WKTReadingError(
264
+ "Could not create geometry because of errors "
265
+ "while reading input.")
280
266
  # avoid circular import dependency
281
267
  from shapely.geometry.base import geom_factory
282
268
  return geom_factory(geom)
@@ -415,8 +401,9 @@ class WKBReader(object):
415
401
  geom = self._lgeos.GEOSWKBReader_read(
416
402
  self._reader, c_char_p(data), c_size_t(len(data)))
417
403
  if not geom:
418
- raise ReadingError("Could not create geometry because of errors "
419
- "while reading input.")
404
+ raise WKBReadingError(
405
+ "Could not create geometry because of errors "
406
+ "while reading input.")
420
407
  # avoid circular import dependency
421
408
  from shapely import geometry
422
409
  return geometry.base.geom_factory(geom)
@@ -428,8 +415,9 @@ class WKBReader(object):
428
415
  geom = self._lgeos.GEOSWKBReader_readHEX(
429
416
  self._reader, c_char_p(data), c_size_t(len(data)))
430
417
  if not geom:
431
- raise ReadingError("Could not create geometry because of errors "
432
- "while reading input.")
418
+ raise WKBReadingError(
419
+ "Could not create geometry because of errors "
420
+ "while reading input.")
433
421
  # avoid circular import dependency
434
422
  from shapely import geometry
435
423
  return geometry.base.geom_factory(geom)