shapely 1.2.2__tar.gz → 1.2.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 (74) hide show
  1. {Shapely-1.2.2 → Shapely-1.2.3}/CHANGES.txt +5 -0
  2. {Shapely-1.2.2 → Shapely-1.2.3}/PKG-INFO +1 -1
  3. {Shapely-1.2.2 → Shapely-1.2.3}/Shapely.egg-info/PKG-INFO +1 -1
  4. {Shapely-1.2.2 → Shapely-1.2.3}/Shapely.egg-info/SOURCES.txt +1 -0
  5. {Shapely-1.2.2 → Shapely-1.2.3}/docs/_build/html/_sources/manual.txt +25 -10
  6. {Shapely-1.2.2 → Shapely-1.2.3}/docs/manual.txt +25 -5
  7. {Shapely-1.2.2 → Shapely-1.2.3}/setup.py +1 -1
  8. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/ctypes_declarations.py +3 -3
  9. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/geometry/__init__.py +2 -2
  10. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/geometry/base.py +6 -3
  11. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/geometry/geo.py +4 -0
  12. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/__init__.py +2 -0
  13. Shapely-1.2.3/shapely/tests/test_mapping.py +11 -0
  14. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/validation.py +1 -1
  15. {Shapely-1.2.2 → Shapely-1.2.3}/CREDITS.txt +0 -0
  16. {Shapely-1.2.2 → Shapely-1.2.3}/LICENSE.txt +0 -0
  17. {Shapely-1.2.2 → Shapely-1.2.3}/MANIFEST.in +0 -0
  18. {Shapely-1.2.2 → Shapely-1.2.3}/README.txt +0 -0
  19. {Shapely-1.2.2 → Shapely-1.2.3}/Shapely.egg-info/dependency_links.txt +0 -0
  20. {Shapely-1.2.2 → Shapely-1.2.3}/Shapely.egg-info/top_level.txt +0 -0
  21. {Shapely-1.2.2 → Shapely-1.2.3}/examples/dissolve.py +0 -0
  22. {Shapely-1.2.2 → Shapely-1.2.3}/examples/intersect.py +0 -0
  23. {Shapely-1.2.2 → Shapely-1.2.3}/setup.cfg +0 -0
  24. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/__init__.py +0 -0
  25. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/coords.py +0 -0
  26. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/geometry/collection.py +0 -0
  27. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/geometry/linestring.py +0 -0
  28. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/geometry/multilinestring.py +0 -0
  29. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/geometry/multipoint.py +0 -0
  30. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/geometry/multipolygon.py +0 -0
  31. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/geometry/point.py +0 -0
  32. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/geometry/polygon.py +0 -0
  33. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/geometry/proxy.py +0 -0
  34. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/geos.py +2 -2
  35. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/impl.py +0 -0
  36. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/iterops.py +0 -0
  37. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/linref.py +0 -0
  38. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/ops.py +0 -0
  39. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/predicates.py +0 -0
  40. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/prepared.py +0 -0
  41. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/Array.txt +0 -0
  42. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/GeoInterface.txt +0 -0
  43. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/IterOps.txt +0 -0
  44. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/LineString.txt +0 -0
  45. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/MultiLineString.txt +0 -0
  46. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/MultiPoint.txt +0 -0
  47. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/MultiPolygon.txt +0 -0
  48. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/Operations.txt +0 -0
  49. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/Persist.txt +0 -0
  50. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/Point.txt +0 -0
  51. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/Polygon.txt +0 -0
  52. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/Predicates.txt +0 -0
  53. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/attribute-chains.txt +0 -0
  54. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/binascii_hex.txt +0 -0
  55. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/cascaded_union.txt +0 -0
  56. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/dimensions.txt +0 -0
  57. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/invalid_intersection.txt +0 -0
  58. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/linear-referencing.txt +0 -0
  59. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/linemerge.txt +0 -0
  60. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/polygonize.txt +0 -0
  61. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/test_collection.py +0 -0
  62. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/test_doctests.py +0 -0
  63. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/test_emptiness.py +0 -0
  64. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/test_equality.py +0 -0
  65. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/test_geomseq.py +0 -0
  66. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/test_prepared.py +0 -0
  67. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/test_singularity.py +0 -0
  68. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/test_validation.py +0 -0
  69. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/test_xy.py +0 -0
  70. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/threading_test.py +0 -0
  71. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/tests/wkt_locale.txt +0 -0
  72. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/topology.py +0 -0
  73. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/wkb.py +0 -0
  74. {Shapely-1.2.2 → Shapely-1.2.3}/shapely/wkt.py +0 -0
@@ -1,5 +1,10 @@
1
1
  All tickets are children of http://trac.gispython.org/lab/ticket.
2
2
 
3
+ 1.2.3 (2010-08-17)
4
+ ------------------
5
+ - Add mapping function.
6
+ - Fix problem with GEOSisValidReason symbol for GEOS < 3.1.
7
+
3
8
  1.2.2 (2010-07-23)
4
9
  ------------------
5
10
  - Add representative_point method.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.0
2
2
  Name: Shapely
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: Geometric objects, predicates, and operations
5
5
  Home-page: http://trac.gispython.org/lab/wiki/Shapely
6
6
  Author: Sean Gillies
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.0
2
2
  Name: Shapely
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: Geometric objects, predicates, and operations
5
5
  Home-page: http://trac.gispython.org/lab/wiki/Shapely
6
6
  Author: Sean Gillies
@@ -64,6 +64,7 @@ shapely/tests/test_doctests.py
64
64
  shapely/tests/test_emptiness.py
65
65
  shapely/tests/test_equality.py
66
66
  shapely/tests/test_geomseq.py
67
+ shapely/tests/test_mapping.py
67
68
  shapely/tests/test_prepared.py
68
69
  shapely/tests/test_singularity.py
69
70
  shapely/tests/test_validation.py
@@ -3,8 +3,8 @@ The Shapely 1.2 User Manual (Preview)
3
3
  =====================================
4
4
 
5
5
  :Author: Sean Gillies, <sean.gillies@gmail.com>
6
- :Revision: 1.2.1
7
- :Date: 13 July 2010
6
+ :Revision: 1.2.2
7
+ :Date: 10 August 2010
8
8
  :Copyright:
9
9
  This work is licensed under a `Creative Commons Attribution 3.0
10
10
  United States License`__.
@@ -214,7 +214,7 @@ General Attributes and Methods
214
214
  geometric object.
215
215
 
216
216
  .. note::
217
- This is not in the general the same as the centroid.
217
+ This is not in general the same as the centroid.
218
218
 
219
219
  .. sourcecode:: pycon
220
220
 
@@ -224,11 +224,6 @@ General Attributes and Methods
224
224
  >>> donut.representative_point().wkt
225
225
  'POINT (-1.5000000000000000 0.0000000000000000)'
226
226
 
227
- .. sourcecode:: pycon
228
-
229
- >>> Point(0,0).distance(Point(1,1))
230
- 1.4142135623730951
231
-
232
227
  .. _points:
233
228
 
234
229
  Points
@@ -1387,8 +1382,8 @@ Figure 1. Convex hull (blue) of 2 points (left) and of 6 points (right).
1387
1382
 
1388
1383
  .. attribute:: object.envelope
1389
1384
 
1390
- Returns a representation of the point or smallest rectangular polygon that
1391
- contains the object.
1385
+ Returns a representation of the point or smallest rectangular polygon (with
1386
+ sides parallel to the coordinate axes) that contains the object.
1392
1387
 
1393
1388
  .. sourcecode:: pycon
1394
1389
 
@@ -1714,6 +1709,26 @@ Or a simple placemark-type object:
1714
1709
  >>> list(shape.coords)
1715
1710
  [(0.0, 0.0)]
1716
1711
 
1712
+ The GeoJSON-like mapping of a geometric object can be obtained using
1713
+ :func:`shapely.geometry.mapping`.
1714
+
1715
+ .. function:: shapely.geometry.mapping(ob)
1716
+
1717
+ Return a new, independent geometry with coordinates `copied` from the
1718
+ context.
1719
+
1720
+ For example, using the same `GeoThing` class:
1721
+
1722
+ .. sourcecode:: pycon
1723
+
1724
+ >>> from shapely.geometry import mapping
1725
+ >>> thing = GeoThing({"type": "Point", "coordinates": (0.0, 0.0)})
1726
+ >>> m = mapping(thing)
1727
+ >>> m['type']
1728
+ 'Point'
1729
+ >>> m['coordinates']
1730
+ (0.0, 0.0)}
1731
+
1717
1732
  Conclusion
1718
1733
  ==========
1719
1734
 
@@ -3,8 +3,8 @@ The Shapely 1.2 User Manual (Preview)
3
3
  =====================================
4
4
 
5
5
  :Author: Sean Gillies, <sean.gillies@gmail.com>
6
- :Revision: 1.2.1
7
- :Date: 13 July 2010
6
+ :Revision: 1.2.2
7
+ :Date: 10 August 2010
8
8
  :Copyright:
9
9
  This work is licensed under a `Creative Commons Attribution 3.0
10
10
  United States License`__.
@@ -214,7 +214,7 @@ General Attributes and Methods
214
214
  geometric object.
215
215
 
216
216
  .. note::
217
- This is not in the general the same as the centroid.
217
+ This is not in general the same as the centroid.
218
218
 
219
219
  .. sourcecode:: pycon
220
220
 
@@ -1382,8 +1382,8 @@ Figure 1. Convex hull (blue) of 2 points (left) and of 6 points (right).
1382
1382
 
1383
1383
  .. attribute:: object.envelope
1384
1384
 
1385
- Returns a representation of the point or smallest rectangular polygon that
1386
- contains the object.
1385
+ Returns a representation of the point or smallest rectangular polygon (with
1386
+ sides parallel to the coordinate axes) that contains the object.
1387
1387
 
1388
1388
  .. sourcecode:: pycon
1389
1389
 
@@ -1709,6 +1709,26 @@ Or a simple placemark-type object:
1709
1709
  >>> list(shape.coords)
1710
1710
  [(0.0, 0.0)]
1711
1711
 
1712
+ The GeoJSON-like mapping of a geometric object can be obtained using
1713
+ :func:`shapely.geometry.mapping`.
1714
+
1715
+ .. function:: shapely.geometry.mapping(ob)
1716
+
1717
+ Return a new, independent geometry with coordinates `copied` from the
1718
+ context.
1719
+
1720
+ For example, using the same `GeoThing` class:
1721
+
1722
+ .. sourcecode:: pycon
1723
+
1724
+ >>> from shapely.geometry import mapping
1725
+ >>> thing = GeoThing({"type": "Point", "coordinates": (0.0, 0.0)})
1726
+ >>> m = mapping(thing)
1727
+ >>> m['type']
1728
+ 'Point'
1729
+ >>> m['coordinates']
1730
+ (0.0, 0.0)}
1731
+
1712
1732
  Conclusion
1713
1733
  ==========
1714
1734
 
@@ -16,7 +16,7 @@ readme_text = file('README.txt', 'rb').read()
16
16
  setup_args = dict(
17
17
  metadata_version = '1.2',
18
18
  name = 'Shapely',
19
- version = '1.2.2',
19
+ version = '1.2.3',
20
20
  requires_python = '>=2.5,<3',
21
21
  requires_external = 'libgeos_c (>=3.1)',
22
22
  description = 'Geometric objects, predicates, and operations',
@@ -167,9 +167,6 @@ def prototype(lgeos, geosVersion):
167
167
  lgeos.GEOSisValid.restype = ctypes.c_byte
168
168
  lgeos.GEOSisValid.argtypes = [ctypes.c_void_p]
169
169
 
170
- lgeos.GEOSisValidReason.restype = allocated_c_char_p
171
- lgeos.GEOSisValidReason.argtypes = [ctypes.c_void_p]
172
-
173
170
  lgeos.GEOSisSimple.restype = ctypes.c_byte
174
171
  lgeos.GEOSisSimple.argtypes = [ctypes.c_void_p]
175
172
 
@@ -249,6 +246,9 @@ def prototype(lgeos, geosVersion):
249
246
  lgeos.GEOSPreparedCovers.restype = ctypes.c_int
250
247
  lgeos.GEOSPreparedCovers.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
251
248
 
249
+ lgeos.GEOSisValidReason.restype = allocated_c_char_p
250
+ lgeos.GEOSisValidReason.argtypes = [ctypes.c_void_p]
251
+
252
252
  # Other, GEOS C API 1.5.0+
253
253
  if geosVersion >= (1, 5, 0):
254
254
  lgeos.GEOSUnionCascaded.restype = ctypes.c_void_p
@@ -1,7 +1,7 @@
1
1
  """Geometry classes and factories
2
2
  """
3
3
 
4
- from geo import shape, asShape
4
+ from geo import shape, asShape, mapping
5
5
  from point import Point, asPoint
6
6
  from linestring import LineString, asLineString
7
7
  from polygon import Polygon, asPolygon
@@ -14,7 +14,7 @@ __all__ = [
14
14
  'shape', 'asShape', 'Point', 'asPoint', 'LineString', 'asLineString',
15
15
  'Polygon', 'asPolygon', 'MultiPoint', 'asMultiPoint',
16
16
  'MultiLineString', 'asMultiLineString', 'MultiPolygon', 'asMultiPolygon',
17
- 'GeometryCollection'
17
+ 'GeometryCollection', 'mapping'
18
18
  ]
19
19
 
20
20
 
@@ -94,10 +94,14 @@ class BaseGeometry(object):
94
94
  def _is_empty(self):
95
95
  return self.__geom__ in [EMPTY, None]
96
96
 
97
+ # a reference to the so/dll proxy to preserve access during clean up
98
+ _lgeos = lgeos
99
+
97
100
  def empty(self):
101
+ # TODO: defer cleanup to the implementation. We shouldn't be
102
+ # explicitly calling a lgeos method here.
98
103
  if not (self._owned or self._is_empty):
99
- from shapely.geos import lgeos
100
- lgeos.GEOSGeom_destroy(self.__geom__)
104
+ self._lgeos.GEOSGeom_destroy(self.__geom__)
101
105
  self.__geom__ = EMPTY
102
106
 
103
107
  def __del__(self):
@@ -574,7 +578,6 @@ class HeterogeneousGeometrySequence(GeometrySequence):
574
578
  g._owned = True
575
579
  return g
576
580
 
577
-
578
581
  # Test runner
579
582
  def _test():
580
583
  import doctest
@@ -62,3 +62,7 @@ def asShape(context):
62
62
  return MultiPolygonAdapter(ob["coordinates"], context_type='geojson')
63
63
  else:
64
64
  raise ValueError("Unknown geometry type: %s" % geom_type)
65
+
66
+ def mapping(ob):
67
+ """Returns a GeoJSON-like mapping"""
68
+ return ob.__geo_interface__
@@ -2,6 +2,7 @@ from unittest import TestSuite
2
2
 
3
3
  import test_doctests, test_prepared, test_equality, test_geomseq, test_xy
4
4
  import test_collection, test_emptiness, test_singularity, test_validation
5
+ import test_mapping
5
6
 
6
7
  def test_suite():
7
8
  suite = TestSuite()
@@ -14,5 +15,6 @@ def test_suite():
14
15
  suite.addTest(test_collection.test_suite())
15
16
  suite.addTest(test_singularity.test_suite())
16
17
  suite.addTest(test_validation.test_suite())
18
+ suite.addTest(test_mapping.test_suite())
17
19
  return suite
18
20
 
@@ -0,0 +1,11 @@
1
+ import unittest
2
+ from shapely.geometry import Point, mapping
3
+
4
+ class MappingTestCase(unittest.TestCase):
5
+ def test_point(self):
6
+ m = mapping(Point(0, 0))
7
+ self.failUnlessEqual(m['type'], 'Point')
8
+ self.failUnlessEqual(m['coordinates'], (0.0, 0.0))
9
+
10
+ def test_suite():
11
+ return unittest.TestLoader().loadTestsFromTestCase(MappingTestCase)
@@ -1,4 +1,4 @@
1
- #
1
+ # TODO: allow for implementations using other than GEOS
2
2
 
3
3
  from shapely.geos import lgeos
4
4
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -298,6 +298,8 @@ class LGEOS15(LGEOSBase):
298
298
  ):
299
299
  pred.func.errcheck = errcheck_predicate
300
300
 
301
+ self.GEOSisValidReason.func.errcheck = errcheck_just_free
302
+
301
303
  self.methods['area'] = self.GEOSArea
302
304
  self.methods['boundary'] = self.GEOSBoundary
303
305
  self.methods['buffer'] = self.GEOSBuffer
@@ -351,8 +353,6 @@ class LGEOS16LR(LGEOS16):
351
353
  def __init__(self, dll):
352
354
  super(LGEOS16LR, self).__init__(dll)
353
355
 
354
- self.GEOSisValidReason.func.errcheck = errcheck_just_free
355
-
356
356
  self.methods['project'] = self.GEOSProject
357
357
  self.methods['project_normalized'] = self.GEOSProjectNormalized
358
358
  self.methods['interpolate'] = self.GEOSInterpolate
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes