[python-shapely] 23/148: Imported Upstream version 1.2.2

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Thu Aug 20 17:41:59 UTC 2015


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository python-shapely.

commit ecf59dae5942b44397ade569abd898293b7588a7
Author: Pietro Battiston <me at pietrobattiston.it>
Date:   Sat Aug 14 22:39:40 2010 +0200

    Imported Upstream version 1.2.2
---
 CHANGES.txt                                |  4 +++
 PKG-INFO                                   |  2 +-
 Shapely.egg-info/PKG-INFO                  |  2 +-
 Shapely.egg-info/SOURCES.txt               |  1 +
 docs/{ => _build/html/_sources}/manual.txt | 47 ++++++++++++++++++++++++++++--
 docs/manual.txt                            | 42 ++++++++++++++++++++++++--
 setup.py                                   |  2 +-
 shapely/geometry/base.py                   |  6 +++-
 shapely/geos.py                            |  2 ++
 shapely/impl.py                            | 21 +++++++++----
 shapely/tests/Operations.txt               |  3 +-
 11 files changed, 116 insertions(+), 16 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index 9e0bb95..1115aab 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,5 +1,9 @@
 All tickets are children of http://trac.gispython.org/lab/ticket.
 
+1.2.2 (2010-07-23)
+------------------
+- Add representative_point method.
+
 1.2.1 (2010-06-23)
 ------------------
 - Fixed bounds of singular polygons.
diff --git a/PKG-INFO b/PKG-INFO
index 38b4232..25d9b53 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.0
 Name: Shapely
-Version: 1.2.1
+Version: 1.2.2
 Summary: Geometric objects, predicates, and operations
 Home-page: http://trac.gispython.org/lab/wiki/Shapely
 Author: Sean Gillies
diff --git a/Shapely.egg-info/PKG-INFO b/Shapely.egg-info/PKG-INFO
index 38b4232..25d9b53 100644
--- a/Shapely.egg-info/PKG-INFO
+++ b/Shapely.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.0
 Name: Shapely
-Version: 1.2.1
+Version: 1.2.2
 Summary: Geometric objects, predicates, and operations
 Home-page: http://trac.gispython.org/lab/wiki/Shapely
 Author: Sean Gillies
diff --git a/Shapely.egg-info/SOURCES.txt b/Shapely.egg-info/SOURCES.txt
index f3483a1..a6b5418 100644
--- a/Shapely.egg-info/SOURCES.txt
+++ b/Shapely.egg-info/SOURCES.txt
@@ -10,6 +10,7 @@ Shapely.egg-info/SOURCES.txt
 Shapely.egg-info/dependency_links.txt
 Shapely.egg-info/top_level.txt
 docs/manual.txt
+docs/_build/html/_sources/manual.txt
 examples/dissolve.py
 examples/intersect.py
 shapely/__init__.py
diff --git a/docs/manual.txt b/docs/_build/html/_sources/manual.txt
similarity index 97%
copy from docs/manual.txt
copy to docs/_build/html/_sources/manual.txt
index de2ec5b..4ebd883 100644
--- a/docs/manual.txt
+++ b/docs/_build/html/_sources/manual.txt
@@ -3,8 +3,8 @@ The Shapely 1.2 User Manual (Preview)
 =====================================
 
 :Author: Sean Gillies, <sean.gillies at gmail.com>
-:Revision: 1.2
-:Date: 24 May 2010
+:Revision: 1.2.1
+:Date: 13 July 2010
 :Copyright: 
   This work is licensed under a `Creative Commons Attribution 3.0
   United States License`__.
@@ -208,6 +208,27 @@ General Attributes and Methods
   >>> Point(0,0).distance(Point(1,1))
   1.4142135623730951
 
+.. method:: object.representative_point()
+
+  Returns a cheaply computed point that is guaranteed to be within the 
+  geometric object.
+
+.. note::
+  This is not in the general the same as the centroid.
+
+.. sourcecode:: pycon
+
+  >>> donut = Point(0, 0).buffer(2.0).difference(Point(0, 0).buffer(1.0))
+  >>> donut.centroid.wkt
+  'POINT (-0.0000000000000001 -0.0000000000000000)'
+  >>> donut.representative_point().wkt
+  'POINT (-1.5000000000000000 0.0000000000000000)'
+
+.. sourcecode:: pycon
+
+  >>> Point(0,0).distance(Point(1,1))
+  1.4142135623730951
+
 .. _points:
 
 Points
@@ -1501,7 +1522,7 @@ first use the :func:`prepared.prep` function.
 .. sourcecode:: pycon
 
   >>> from shapely.geometry import Point
-  >>> from shapely.prepared import polyprep
+  >>> from shapely.prepared import prep
   >>> points = [...] # large list of points
   >>> polygon = Point(0.0, 0.0).buffer(1.0)
   >>> prepared_polygon = prep(polygon)
@@ -1514,6 +1535,26 @@ Prepared geometries instances have the following methods: ``contains``,
 same arguments and usage as their counterparts in non-prepared geometric
 objects.
 
+Diagnostics
+-----------
+
+.. function:: validation.explain_validity(ob):
+
+  Returns a string explaining the validity or invalidity of the object.
+
+  `New in version 1.2.1`.
+
+The messages may or may not have a representation of a problem point that can
+be parsed out.
+
+.. sourcecode:: python
+
+  >>> coords = [(0, 0), (0, 2), (1, 1), (2, 2), (2, 0), (1, 1), (0, 0)]
+  >>> p = Polygon(coords)
+  >>> from shapely.validation import explain_validity
+  >>> explain_validity(p)
+  'Ring Self-intersection[1 1]'
+
 Interoperation
 ==============
 
diff --git a/docs/manual.txt b/docs/manual.txt
index de2ec5b..350acc0 100644
--- a/docs/manual.txt
+++ b/docs/manual.txt
@@ -3,8 +3,8 @@ The Shapely 1.2 User Manual (Preview)
 =====================================
 
 :Author: Sean Gillies, <sean.gillies at gmail.com>
-:Revision: 1.2
-:Date: 24 May 2010
+:Revision: 1.2.1
+:Date: 13 July 2010
 :Copyright: 
   This work is licensed under a `Creative Commons Attribution 3.0
   United States License`__.
@@ -208,6 +208,22 @@ General Attributes and Methods
   >>> Point(0,0).distance(Point(1,1))
   1.4142135623730951
 
+.. method:: object.representative_point()
+
+  Returns a cheaply computed point that is guaranteed to be within the 
+  geometric object.
+
+.. note::
+  This is not in the general the same as the centroid.
+
+.. sourcecode:: pycon
+
+  >>> donut = Point(0, 0).buffer(2.0).difference(Point(0, 0).buffer(1.0))
+  >>> donut.centroid.wkt
+  'POINT (-0.0000000000000001 -0.0000000000000000)'
+  >>> donut.representative_point().wkt
+  'POINT (-1.5000000000000000 0.0000000000000000)'
+
 .. _points:
 
 Points
@@ -1501,7 +1517,7 @@ first use the :func:`prepared.prep` function.
 .. sourcecode:: pycon
 
   >>> from shapely.geometry import Point
-  >>> from shapely.prepared import polyprep
+  >>> from shapely.prepared import prep
   >>> points = [...] # large list of points
   >>> polygon = Point(0.0, 0.0).buffer(1.0)
   >>> prepared_polygon = prep(polygon)
@@ -1514,6 +1530,26 @@ Prepared geometries instances have the following methods: ``contains``,
 same arguments and usage as their counterparts in non-prepared geometric
 objects.
 
+Diagnostics
+-----------
+
+.. function:: validation.explain_validity(ob):
+
+  Returns a string explaining the validity or invalidity of the object.
+
+  `New in version 1.2.1`.
+
+The messages may or may not have a representation of a problem point that can
+be parsed out.
+
+.. sourcecode:: python
+
+  >>> coords = [(0, 0), (0, 2), (1, 1), (2, 2), (2, 0), (1, 1), (0, 0)]
+  >>> p = Polygon(coords)
+  >>> from shapely.validation import explain_validity
+  >>> explain_validity(p)
+  'Ring Self-intersection[1 1]'
+
 Interoperation
 ==============
 
diff --git a/setup.py b/setup.py
index 0ed51f1..6b0cc65 100644
--- a/setup.py
+++ b/setup.py
@@ -16,7 +16,7 @@ readme_text = file('README.txt', 'rb').read()
 setup_args = dict(
     metadata_version    = '1.2',
     name                = 'Shapely',
-    version             = '1.2.1',
+    version             = '1.2.2',
     requires_python     = '>=2.5,<3',
     requires_external   = 'libgeos_c (>=3.1)', 
     description         = 'Geometric objects, predicates, and operations',
diff --git a/shapely/geometry/base.py b/shapely/geometry/base.py
index 828d3a8..bffa6dc 100644
--- a/shapely/geometry/base.py
+++ b/shapely/geometry/base.py
@@ -243,9 +243,13 @@ class BaseGeometry(object):
             
     @property
     def centroid(self):
-        """Returns the geometric center of the polygon"""
+        """Returns the geometric center of the object"""
         return geom_factory(self.impl['centroid'](self))
 
+    def representative_point(self):
+        """Returns a point guaranteed to be within the object, cheaply."""
+        return geom_factory(self.impl['representative_point'](self))
+
     @property
     def convex_hull(self):
         """Imagine an elastic band stretched around the geometry: that's a 
diff --git a/shapely/geos.py b/shapely/geos.py
index ef096ce..0f80ced 100644
--- a/shapely/geos.py
+++ b/shapely/geos.py
@@ -231,6 +231,7 @@ class LGEOS14(LGEOSBase):
         self.methods['boundary'] = self.GEOSBoundary
         self.methods['buffer'] = self.GEOSBuffer
         self.methods['centroid'] = self.GEOSGetCentroid
+        self.methods['representative_point'] = self.GEOSPointOnSurface
         self.methods['convex_hull'] = self.GEOSConvexHull
         self.methods['distance'] = self.GEOSDistance
         self.methods['envelope'] = self.GEOSEnvelope
@@ -301,6 +302,7 @@ class LGEOS15(LGEOSBase):
         self.methods['boundary'] = self.GEOSBoundary
         self.methods['buffer'] = self.GEOSBuffer
         self.methods['centroid'] = self.GEOSGetCentroid
+        self.methods['representative_point'] = self.GEOSPointOnSurface
         self.methods['convex_hull'] = self.GEOSConvexHull
         self.methods['distance'] = self.GEOSDistance
         self.methods['envelope'] = self.GEOSEnvelope
diff --git a/shapely/impl.py b/shapely/impl.py
index 063925b..5497672 100644
--- a/shapely/impl.py
+++ b/shapely/impl.py
@@ -1,4 +1,14 @@
 """Implementation of the intermediary layer between Shapely and GEOS
+
+This is layer number 2 from the list below.
+
+1) geometric objects: the Python OO API.
+2) implementation map: an abstraction that permits different backends.
+3) backend: callable objects that take Shapely geometric objects as arguments 
+   and, with GEOS as a backend, translate them to C data structures.
+4) GEOS library: algorithms implemented in C++.
+
+Shapely 1.2 includes a GEOS backend and it is the default.
 """
 
 from shapely.coords import BoundsOp
@@ -19,6 +29,7 @@ IMPL14 = {
     'boundary': (UnaryTopologicalOp, 'boundary'),
     'bounds': (BoundsOp, None),
     'centroid': (UnaryTopologicalOp, 'centroid'),
+    'representative_point': (UnaryTopologicalOp, 'representative_point'),
     'envelope': (UnaryTopologicalOp, 'envelope'),
     'convex_hull': (UnaryTopologicalOp, 'convex_hull'),
     'buffer': (UnaryTopologicalOp, 'buffer'),
@@ -67,15 +78,15 @@ IMPL16LR = {
     'interpolate': (InterpolateOp, 'interpolate'),
     }
 
-def build(defs):
+def impl_items(defs):
     return [(k, v[0](v[1])) for k, v in defs.items()]
 
-imp = dict(build(IMPL14))
+imp = dict(impl_items(IMPL14))
 if lgeos.geos_capi_version >= (1, 5, 0):
-    imp.update(build(IMPL15))
+    imp.update(impl_items(IMPL15))
 if lgeos.geos_capi_version >= (1, 6, 0):
-    imp.update(build(IMPL16))
+    imp.update(impl_items(IMPL16))
     if 'project' in lgeos.methods:
-        imp.update(build(IMPL16LR))
+        imp.update(impl_items(IMPL16LR))
 
 DefaultImplementation = imp
diff --git a/shapely/tests/Operations.txt b/shapely/tests/Operations.txt
index 8ff4c2b..c41b8b7 100644
--- a/shapely/tests/Operations.txt
+++ b/shapely/tests/Operations.txt
@@ -76,7 +76,8 @@ Topology operations
   >>> point.union(Point(-1, 1)) #doctest: +ELLIPSIS
   <shapely.geometry.multipoint.MultiPoint object at ...>
 
-  Point on Surface (TODO?)
+  >>> point.representative_point() #doctest: +ELLIPSIS
+  <shapely.geometry.point.Point object at ...>
 
   >>> point.centroid #doctest: +ELLIPSIS
   <shapely.geometry.point.Point object at ...>

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/python-shapely.git



More information about the Pkg-grass-devel mailing list