shapely 1.0.11__tar.gz → 1.0.12__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 (63) hide show
  1. {Shapely-1.0.11 → Shapely-1.0.12}/CHANGES.txt +4 -0
  2. {Shapely-1.0.11 → Shapely-1.0.12}/PKG-INFO +1 -1
  3. {Shapely-1.0.11 → Shapely-1.0.12}/Shapely.egg-info/PKG-INFO +1 -1
  4. {Shapely-1.0.11 → Shapely-1.0.12}/Shapely.egg-info/SOURCES.txt +1 -1
  5. {Shapely-1.0.11 → Shapely-1.0.12}/Shapely.egg-info/dependency_links.txt +0 -0
  6. {Shapely-1.0.11 → Shapely-1.0.12}/Shapely.egg-info/requires.txt +0 -0
  7. {Shapely-1.0.11 → Shapely-1.0.12}/Shapely.egg-info/top_level.txt +0 -0
  8. {Shapely-1.0.11 → Shapely-1.0.12}/setup.py +1 -1
  9. {Shapely-1.0.11 → Shapely-1.0.12}/setup_windows.py +1 -1
  10. {Shapely-1.0.11 → Shapely-1.0.12}/shapely/iterops.py +18 -22
  11. {Shapely-1.0.11 → Shapely-1.0.12}/shapely/predicates.py +13 -8
  12. {Shapely-1.0.11 → Shapely-1.0.12}/shapely/topology.py +34 -26
  13. {Shapely-1.0.11 → Shapely-1.0.12}/shapely/wkt.py +1 -1
  14. {Shapely-1.0.11 → Shapely-1.0.12}/tests/attribute-chains.txt +2 -1
  15. {Shapely-1.0.11 → Shapely-1.0.12}/tests/test_doctests.py +1 -0
  16. Shapely-1.0.12/tests/wkt_locale.txt +26 -0
  17. Shapely-1.0.11/shapely/kml.py +0 -0
  18. {Shapely-1.0.11 → Shapely-1.0.12}/CREDITS.txt +0 -0
  19. {Shapely-1.0.11 → Shapely-1.0.12}/GEOS-C-API.txt +0 -0
  20. {Shapely-1.0.11 → Shapely-1.0.12}/HISTORY.txt +0 -0
  21. {Shapely-1.0.11 → Shapely-1.0.12}/LICENSE.txt +0 -0
  22. {Shapely-1.0.11 → Shapely-1.0.12}/README.txt +0 -0
  23. {Shapely-1.0.11 → Shapely-1.0.12}/examples/geoms.py +0 -0
  24. {Shapely-1.0.11 → Shapely-1.0.12}/examples/world.py +0 -0
  25. {Shapely-1.0.11 → Shapely-1.0.12}/manual/manual.txt +0 -0
  26. {Shapely-1.0.11 → Shapely-1.0.12}/manual/style.css +0 -0
  27. {Shapely-1.0.11 → Shapely-1.0.12}/setup.cfg +0 -0
  28. {Shapely-1.0.11 → Shapely-1.0.12}/shapely/__init__.py +0 -0
  29. {Shapely-1.0.11 → Shapely-1.0.12}/shapely/ctypes_declarations.py +0 -0
  30. {Shapely-1.0.11 → Shapely-1.0.12}/shapely/geometry/__init__.py +0 -0
  31. {Shapely-1.0.11 → Shapely-1.0.12}/shapely/geometry/base.py +0 -0
  32. {Shapely-1.0.11 → Shapely-1.0.12}/shapely/geometry/collection.py +0 -0
  33. {Shapely-1.0.11 → Shapely-1.0.12}/shapely/geometry/geo.py +0 -0
  34. {Shapely-1.0.11 → Shapely-1.0.12}/shapely/geometry/linestring.py +0 -0
  35. {Shapely-1.0.11 → Shapely-1.0.12}/shapely/geometry/multilinestring.py +0 -0
  36. {Shapely-1.0.11 → Shapely-1.0.12}/shapely/geometry/multipoint.py +0 -0
  37. {Shapely-1.0.11 → Shapely-1.0.12}/shapely/geometry/multipolygon.py +0 -0
  38. {Shapely-1.0.11 → Shapely-1.0.12}/shapely/geometry/point.py +0 -0
  39. {Shapely-1.0.11 → Shapely-1.0.12}/shapely/geometry/polygon.py +0 -0
  40. {Shapely-1.0.11 → Shapely-1.0.12}/shapely/geometry/proxy.py +0 -0
  41. {Shapely-1.0.11 → Shapely-1.0.12}/shapely/geos.py +0 -0
  42. {Shapely-1.0.11 → Shapely-1.0.12}/shapely/ops.py +0 -0
  43. {Shapely-1.0.11 → Shapely-1.0.12}/shapely/wkb.py +0 -0
  44. {Shapely-1.0.11 → Shapely-1.0.12}/tests/Array.txt +0 -0
  45. {Shapely-1.0.11 → Shapely-1.0.12}/tests/GeoInterface.txt +0 -0
  46. {Shapely-1.0.11 → Shapely-1.0.12}/tests/IterOps.txt +0 -0
  47. {Shapely-1.0.11 → Shapely-1.0.12}/tests/LineString.txt +0 -0
  48. {Shapely-1.0.11 → Shapely-1.0.12}/tests/MultiLineString.txt +0 -0
  49. {Shapely-1.0.11 → Shapely-1.0.12}/tests/MultiPoint.txt +0 -0
  50. {Shapely-1.0.11 → Shapely-1.0.12}/tests/MultiPolygon.txt +0 -0
  51. {Shapely-1.0.11 → Shapely-1.0.12}/tests/Operations.txt +0 -0
  52. {Shapely-1.0.11 → Shapely-1.0.12}/tests/Persist.txt +0 -0
  53. {Shapely-1.0.11 → Shapely-1.0.12}/tests/Point.txt +0 -0
  54. {Shapely-1.0.11 → Shapely-1.0.12}/tests/Polygon.txt +0 -0
  55. {Shapely-1.0.11 → Shapely-1.0.12}/tests/Predicates.txt +0 -0
  56. {Shapely-1.0.11 → Shapely-1.0.12}/tests/__init__.py +0 -0
  57. {Shapely-1.0.11 → Shapely-1.0.12}/tests/binascii_hex.txt +0 -0
  58. {Shapely-1.0.11 → Shapely-1.0.12}/tests/dimensions.txt +0 -0
  59. {Shapely-1.0.11 → Shapely-1.0.12}/tests/invalid_intersection.txt +0 -0
  60. {Shapely-1.0.11 → Shapely-1.0.12}/tests/polygonize.txt +0 -0
  61. {Shapely-1.0.11 → Shapely-1.0.12}/tests/rungrind.dist +0 -0
  62. {Shapely-1.0.11 → Shapely-1.0.12}/tests/test_threads.py +0 -0
  63. {Shapely-1.0.11 → Shapely-1.0.12}/tests/valgrind-python.supp +0 -0
@@ -1,5 +1,9 @@
1
1
  All tickets are children of http://trac.gispython.org/lab/ticket.
2
2
 
3
+ 1.0.12 (2009-04-09)
4
+ -------------------
5
+ - Fix for references held by topology and predicate descriptors.
6
+
3
7
  1.0.11 (2008-11-20)
4
8
  -------------------
5
9
  - Work around bug in GEOS 2.2.3, GEOSCoordSeq_getOrdinate not exported properly
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.0
2
2
  Name: Shapely
3
- Version: 1.0.11
3
+ Version: 1.0.12
4
4
  Summary: Geospatial geometries, 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.0.11
3
+ Version: 1.0.12
4
4
  Summary: Geospatial geometries, predicates, and operations
5
5
  Home-page: http://trac.gispython.org/lab/wiki/Shapely
6
6
  Author: Sean Gillies
@@ -19,7 +19,6 @@ shapely/__init__.py
19
19
  shapely/ctypes_declarations.py
20
20
  shapely/geos.py
21
21
  shapely/iterops.py
22
- shapely/kml.py
23
22
  shapely/ops.py
24
23
  shapely/predicates.py
25
24
  shapely/topology.py
@@ -58,3 +57,4 @@ tests/rungrind.dist
58
57
  tests/test_doctests.py
59
58
  tests/test_threads.py
60
59
  tests/valgrind-python.supp
60
+ tests/wkt_locale.txt
@@ -10,7 +10,7 @@ if version_info[:2] < (2,5):
10
10
  readme_text = file('README.txt', 'rb').read()
11
11
 
12
12
  setup(name = 'Shapely',
13
- version = '1.0.11',
13
+ version = '1.0.12',
14
14
  description = 'Geospatial geometries, predicates, and operations',
15
15
  license = 'BSD',
16
16
  keywords = 'geometry topology',
@@ -10,7 +10,7 @@ if version_info[:2] < (2,5):
10
10
  readme_text = file('README.txt', 'rb').read()
11
11
 
12
12
  setup(name = 'Shapely',
13
- version = '1.0.11',
13
+ version = '1.0.12',
14
14
  description = 'Geospatial geometries, predicates, and operations',
15
15
  license = 'BSD',
16
16
  keywords = 'geometry topology',
@@ -13,23 +13,17 @@ def geos_from_geometry(geom):
13
13
  c_size_t(len(data))
14
14
  )
15
15
 
16
- class BinaryPredicateIterator(object):
16
+
17
+ class IterOp(object):
17
18
 
18
19
  """A generating non-data descriptor.
19
20
  """
20
-
21
- fn = None
22
- context = None
23
-
21
+
24
22
  def __init__(self, fn):
25
23
  self.fn = fn
26
-
27
- def __get__(self, obj, objtype=None):
28
- self.context = obj
29
- return self
30
-
31
- def __call__(self, geom, iterator, value=True):
32
- if geom._geom is None:
24
+
25
+ def __call__(self, context, iterator, value=True):
26
+ if context._geom is None:
33
27
  raise ValueError, "Null geometry supports no operations"
34
28
  for item in iterator:
35
29
  try:
@@ -39,18 +33,20 @@ class BinaryPredicateIterator(object):
39
33
  ob = this_geom
40
34
  if not this_geom._geom:
41
35
  raise ValueError, "Null geometry supports no operations"
42
- retval = self.fn(geom._geom, this_geom._geom)
36
+ retval = self.fn(context._geom, this_geom._geom)
43
37
  if retval == 2:
44
- raise PredicateError, "Failed to evaluate %s" % repr(self.fn)
38
+ raise PredicateError, \
39
+ "Failed to evaluate %s" % repr(self.fn)
45
40
  elif bool(retval) == value:
46
41
  yield ob
47
42
 
43
+
48
44
  # utilities
49
- disjoint = BinaryPredicateIterator(lgeos.GEOSDisjoint)
50
- touches = BinaryPredicateIterator(lgeos.GEOSTouches)
51
- intersects = BinaryPredicateIterator(lgeos.GEOSIntersects)
52
- crosses = BinaryPredicateIterator(lgeos.GEOSCrosses)
53
- within = BinaryPredicateIterator(lgeos.GEOSWithin)
54
- contains = BinaryPredicateIterator(lgeos.GEOSContains)
55
- overlaps = BinaryPredicateIterator(lgeos.GEOSOverlaps)
56
- equals = BinaryPredicateIterator(lgeos.GEOSEquals)
45
+ disjoint = IterOp(lgeos.GEOSDisjoint)
46
+ touches = IterOp(lgeos.GEOSTouches)
47
+ intersects = IterOp(lgeos.GEOSIntersects)
48
+ crosses = IterOp(lgeos.GEOSCrosses)
49
+ within = IterOp(lgeos.GEOSWithin)
50
+ contains = IterOp(lgeos.GEOSContains)
51
+ overlaps = IterOp(lgeos.GEOSOverlaps)
52
+ equals = IterOp(lgeos.GEOSEquals)
@@ -4,7 +4,18 @@ Support for GEOS spatial predicates.
4
4
 
5
5
  from shapely.geos import PredicateError
6
6
 
7
- # Predicates
7
+
8
+ class OpWrapper(object):
9
+
10
+ def __init__(self, fn, context):
11
+ self.fn = fn
12
+ self.context = context
13
+
14
+ def __call__(self, other):
15
+ if not other._geom:
16
+ raise ValueError, "Null geometry can not be operated upon"
17
+ return bool(self.fn(self.context._geom, other._geom))
18
+
8
19
 
9
20
  class BinaryPredicate(object):
10
21
 
@@ -25,13 +36,7 @@ class BinaryPredicate(object):
25
36
  def __get__(self, obj, objtype=None):
26
37
  if not obj._geom:
27
38
  raise ValueError, "Null geometry supports no operations"
28
- self.context = obj
29
- return self
30
-
31
- def __call__(self, other):
32
- if not other._geom:
33
- raise ValueError, "Null geometry can not be operated upon"
34
- return bool(self.fn(self.context._geom, other._geom))
39
+ return OpWrapper(self.fn, obj)
35
40
 
36
41
 
37
42
  # A data descriptor
@@ -5,44 +5,52 @@ Support for GEOS topological operations.
5
5
  from shapely.geos import TopologicalError
6
6
 
7
7
 
8
+ class OpWrapper(object):
9
+
10
+ def __init__(self, fn, context, factory):
11
+ self.fn = fn
12
+ self.context = context
13
+ self.factory = factory
14
+
15
+ def __call__(self, other):
16
+ context = self.context
17
+ if other._geom is None:
18
+ raise ValueError, "Null geometry supports no operations"
19
+ product = self.fn(context._geom, other._geom)
20
+ if not product:
21
+ # Check validity of geometries
22
+ if not context.is_valid:
23
+ raise TopologicalError, \
24
+ "The operation '%s' produced a null geometry. Likely cause is invalidity of the geometry %s" % (self.fn.__name__, repr(context))
25
+ elif not other.is_valid:
26
+ raise TopologicalError, \
27
+ "The operation '%s' produced a null geometry. Likely cause is invalidity of the 'other' geometry %s" % (self.fn.__name__, repr(other))
28
+ return self.factory(product)
29
+
30
+
8
31
  class BinaryTopologicalOp(object):
9
-
10
- """A callable non-data descriptor.
11
-
32
+
33
+ """A non-data descriptor that returns a callable.
34
+
12
35
  Wraps a GEOS function. The factory is a callable which wraps results in
13
36
  the appropriate shapely geometry class.
14
37
  """
15
-
38
+
16
39
  fn = None
17
- context = None
18
40
  factory = None
19
-
41
+
20
42
  def __init__(self, fn, factory):
21
43
  self.fn = fn
22
44
  self.factory = factory
23
-
45
+
24
46
  def __get__(self, obj, objtype=None):
25
- self.context = obj
26
- return self
27
-
28
- def __call__(self, other):
29
- if self.context._geom is None or other._geom is None:
47
+ if not obj._geom:
30
48
  raise ValueError, "Null geometry supports no operations"
31
- product = self.fn(self.context._geom, other._geom)
32
- if not product:
33
- # Check validity of geometries
34
- if not self.context.is_valid:
35
- raise TopologicalError, \
36
- "The operation '%s' produced a null geometry. Likely cause is invalidity of the geometry %s" % (self.fn.__name__, repr(self.context))
37
- elif not other.is_valid:
38
- raise TopologicalError, \
39
- "The operation '%s' produced a null geometry. Likely cause is invalidity of the 'other' geometry %s" % (self.fn.__name__, repr(other))
40
-
41
- return self.factory(product, self.context)
49
+ return OpWrapper(self.fn, obj, self.factory)
42
50
 
43
51
 
44
52
  class UnaryTopologicalOp(object):
45
-
53
+
46
54
  """A data descriptor.
47
55
 
48
56
  Wraps a GEOS function. The factory is a callable which wraps results in
@@ -51,11 +59,11 @@ class UnaryTopologicalOp(object):
51
59
 
52
60
  fn = None
53
61
  factory = None
54
-
62
+
55
63
  def __init__(self, fn, factory):
56
64
  self.fn = fn
57
65
  self.factory = factory
58
-
66
+
59
67
  def __get__(self, obj, objtype=None):
60
68
  if obj._geom is None:
61
69
  raise ValueError, "Null geometry supports no operations"
@@ -32,7 +32,7 @@ def dumps(ob):
32
32
  return retval
33
33
  func.restype = allocated_c_char_p
34
34
  func.errcheck = errcheck
35
- return lgeos.GEOSGeomToWKT(ob._geom)
35
+ return func(ob._geom)
36
36
 
37
37
  def dump(ob, fp):
38
38
  """Dump a geometry to an open file."""
@@ -8,7 +8,8 @@ See also ticket #151.
8
8
  >>> list(p.boundary.coords)
9
9
  [(0.0, 0.0), (0.0, 1.0), (-1.0, 1.0), (-1.0, 0.0), (0.0, 0.0)]
10
10
 
11
- >>> print list(p.buffer(1).exterior.coords)
11
+ >>> from shapely.geometry import Point
12
+ >>> print list(Point(0.0, 0.0).buffer(1.0).exterior.coords)
12
13
  [(0.0, -1.0), (-1.0, -1.0), ...
13
14
 
14
15
  Test chained access to interiors
@@ -8,6 +8,7 @@ optionflags = (doctest.REPORT_ONLY_FIRST_FAILURE |
8
8
  doctest.ELLIPSIS)
9
9
 
10
10
  def list_doctests():
11
+ print __file__
11
12
  return [filename
12
13
  for filename
13
14
  in glob.glob(os.path.join(os.path.dirname(__file__), '*.txt'))]
@@ -0,0 +1,26 @@
1
+ Test locale independence of WKT
2
+ ===============================
3
+
4
+ Set locale to one that uses a comma as decimal seperator`
5
+
6
+ >>> import locale
7
+ >>> locale.setlocale(locale.LC_ALL, 'pt_BR.UTF-8')
8
+ 'pt_BR.UTF-8'
9
+
10
+ Test reading and writing`
11
+
12
+ >>> from shapely.wkt import loads
13
+ >>> p = loads('POINT (0.0 0.0)')
14
+ >>> p.x == 0.0
15
+ True
16
+ >>> p.y == 0.0
17
+ True
18
+ >>> p.wkt
19
+ 'POINT (0.0...)'
20
+ >>> from shapely.wkt import dumps
21
+ >>> dumps(p)
22
+ 'POINT (0.0...)'
23
+
24
+ Reset locale
25
+
26
+ >>> _ = locale.setlocale(locale.LC_ALL, '')
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
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes