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

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

commit 17bd13e4c5430cf72720ac2a9bec42fccaf4b41f
Author: Bas Couwenberg <sebas...@xs4all.nl>
Date:   Thu Oct 26 19:53:33 2017 +0200

    New upstream version 1.6.2
---
 CHANGES.txt         | 10 ++++++++++
 docs/manual.rst     |  7 ++++++-
 shapely/__init__.py |  2 +-
 shapely/ops.py      | 23 +++++++++++++----------
 tests/test_split.py | 28 ++++++++++++++++++----------
 5 files changed, 48 insertions(+), 22 deletions(-)

diff --git a/CHANGES.txt b/CHANGES.txt
index c00514c..8dd19ad 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,16 @@
 Changes
 =======
 
+1.6.2 (2017-10-26)
+------------------
+
+- Handle a ``TypeError`` that can occur when geometries are torn down (#473,
+  #528).
+- Splitting a linestring by one of its end points will now succeed instead of
+  failing with a ``ValueError`` (#524, #533).
+- Missing documentation of a geometry's ``overlaps`` predicate has been added
+  (#522).
+
 1.6.1 (2017-09-01)
 ------------------
 
diff --git a/docs/manual.rst b/docs/manual.rst
index 12c7536..8ad4665 100644
--- a/docs/manual.rst
+++ b/docs/manual.rst
@@ -442,7 +442,7 @@ constructor parameter.
 Polygons
 --------
 
-.. class:: Polygon(exterior [,interiors=None])
+.. class:: Polygon(shell [,holes=None])
 
   The `Polygon` constructor takes two positional parameters. The first is an
   ordered sequence of ``(x, y[, z])`` point tuples and is treated exactly as in
@@ -1145,6 +1145,11 @@ This predicate applies to all types and is the inverse 
of :meth:`intersects`.
 In other words, geometric objects intersect if they have any boundary or 
 interior point in common.
 
+.. method:: object.overlaps(other)
+
+  Returns ``True`` if the objects intersect (see above) but neither contains
+  the other.
+
 .. method:: object.touches(other)
 
   Returns ``True`` if the objects have at least one point in common and their
diff --git a/shapely/__init__.py b/shapely/__init__.py
index f49459c..51bbb3f 100644
--- a/shapely/__init__.py
+++ b/shapely/__init__.py
@@ -1 +1 @@
-__version__ = "1.6.1"
+__version__ = "1.6.2"
diff --git a/shapely/ops.py b/shapely/ops.py
index 68fcbcd..7f6c050 100644
--- a/shapely/ops.py
+++ b/shapely/ops.py
@@ -257,7 +257,7 @@ def transform(func, geom):
 
 def nearest_points(g1, g2):
     """Returns the calculated nearest points in the input geometries
-    
+
     The points are returned in the same order as the input geometries.
     """
     seq = lgeos.methods['nearest_points'](g1._geom, g2._geom)
@@ -339,21 +339,21 @@ class SplitOp(object):
         union = poly.boundary.union(splitter)
 
         # some polygonized geometries may be holes, we do not want them
-        # that's why we test if the original polygon (poly) contains 
+        # that's why we test if the original polygon (poly) contains
         # an inner point of polygonized geometry (pg)
         return [pg for pg in polygonize(union) if 
poly.contains(pg.representative_point())]
 
     @staticmethod
     def _split_line_with_line(line, splitter):
         """Split a LineString with another (Multi)LineString or 
(Multi)Polygon"""
-        
+
         # if splitter is a polygon, pick it's boundary
         if splitter.type in ('Polygon', 'MultiPolygon'):
             splitter = splitter.boundary
 
         assert(isinstance(line, LineString))
         assert(isinstance(splitter, LineString) or isinstance(splitter, 
MultiLineString))
-        
+
         if splitter.crosses(line):
             # The lines cross --> return multilinestring from the split
             return line.difference(splitter)
@@ -364,7 +364,7 @@ class SplitOp(object):
             # The lines do not cross --> return collection with identity line
             return [line]
 
-    @staticmethod  
+    @staticmethod
     def _split_line_with_point(line, splitter):
         """Split a LineString with a Point"""
 
@@ -374,10 +374,13 @@ class SplitOp(object):
         # check if point is in the interior of the line
         if not line.relate_pattern(splitter, '0********'):
             # point not on line interior --> return collection with single 
identity line
-            # (REASONING: Returning a list with the input line reference and 
creating a 
-            # GeometryCollection at the general split function prevents 
unnecessary copying 
+            # (REASONING: Returning a list with the input line reference and 
creating a
+            # GeometryCollection at the general split function prevents 
unnecessary copying
             # of linestrings in multipoint splitting function)
             return [line]
+        elif line.coords[0] == splitter.coords[0]:
+            # if line is a closed ring the previous test doesn't behave as 
desired
+            return [line]
 
         # point is on line, get the distance from the first point on line
         distance_on_line = line.project(splitter)
@@ -388,7 +391,7 @@ class SplitOp(object):
             pd = line.project(Point(p))
             if pd == distance_on_line:
                 return [
-                    LineString(coords[:i+1]), 
+                    LineString(coords[:i+1]),
                     LineString(coords[i:])
                 ]
             elif distance_on_line < pd:
@@ -414,9 +417,9 @@ class SplitOp(object):
                 # add the newly split 2 lines or the same line if not split
                 new_chunks.extend(SplitOp._split_line_with_point(chunk, pt))
             chunks = new_chunks
-        
+
         return chunks
-    
+
     @staticmethod
     def split(geom, splitter):
         """
diff --git a/tests/test_split.py b/tests/test_split.py
index dcaae0b..c18f088 100644
--- a/tests/test_split.py
+++ b/tests/test_split.py
@@ -7,7 +7,7 @@ from shapely.ops import cascaded_union, linemerge
 
 class TestSplitGeometry(unittest.TestCase):
        # helper class for testing below
-       def helper(self, geom, splitter, expected_chunks):      
+       def helper(self, geom, splitter, expected_chunks):
                s = split(geom, splitter)
                self.assertEqual(s.type, "GeometryCollection")
                self.assertEqual(len(s), expected_chunks)
@@ -25,6 +25,14 @@ class TestSplitGeometry(unittest.TestCase):
                        # not split --> expected equal to line
                        self.assertTrue(s[0].equals(geom))
 
+       def test_split_closed_line_with_point(self):
+               # point at start/end of closed ring -> return equal
+               # see GH #524
+               ls = LineString([(0,0), (0, 1), (1, 1), (1, 0), (0, 0)])
+               splitter = Point(0, 0)
+               self.helper(ls, splitter, 1)
+
+
 class TestSplitPolygon(TestSplitGeometry):
        poly_simple = Polygon([(0, 0), (2, 0), (2, 2), (0, 2), (0, 0)])
        poly_hole = Polygon([(0, 0), (2, 0), (2, 2), (0, 2), (0, 0)], [[(0.5, 
0.5), (0.5, 1.5), (1.5, 1.5), (1.5, 0.5), (0.5, 0.5)]])
@@ -94,7 +102,7 @@ class TestSplitLine(TestSplitGeometry):
        def test_split_line_with_line(self):
                # crosses at one point --> return 2 segments
                splitter = LineString([(0, 1), (1, 0)])
-               self.helper(self.ls, splitter, 2)       
+               self.helper(self.ls, splitter, 2)
 
                # crosses at two points --> return 3 segments
                splitter = LineString([(0, 1), (1, 0), (1, 2)])
@@ -117,7 +125,7 @@ class TestSplitLine(TestSplitGeometry):
        def test_split_line_with_multiline(self):
                # crosses at one point --> return 2 segments
                splitter = MultiLineString([[(0, 1), (1, 0)], [(0, 0), (2, 
-2)]])
-               self.helper(self.ls, splitter, 2)       
+               self.helper(self.ls, splitter, 2)
 
                # crosses at two points --> return 3 segments
                splitter = MultiLineString([[(0, 1), (1, 0)], [(0, 2), (2, 0)]])
@@ -158,7 +166,7 @@ class TestSplitLine(TestSplitGeometry):
                self.helper(self.ls, splitter, 4)
 
 class TestSplitMulti(TestSplitGeometry):
-       
+
        def test_split_multiline_with_point(self):
                # a cross-like multilinestring with a point in the middle --> 
return 4 line segments
                l1 = LineString([(0, 1), (2, 1)])
@@ -166,27 +174,27 @@ class TestSplitMulti(TestSplitGeometry):
                ml = MultiLineString([l1, l2])
                splitter = Point((1, 1))
                self.helper(ml, splitter, 4)
-               
+
        def test_split_multiline_with_multipoint(self):
-               # a cross-like multilinestring with a point in middle, a point 
on one of the lines and a point in the exterior 
+               # a cross-like multilinestring with a point in middle, a point 
on one of the lines and a point in the exterior
                # --> return 4+1 line segments
                l1 = LineString([(0, 1), (3, 1)])
                l2 = LineString([(1, 0), (1, 2)])
                ml = MultiLineString([l1, l2])
                splitter = MultiPoint([(1, 1), (2, 1), (4, 2)])
                self.helper(ml, splitter, 5)
-                               
+
        def test_split_multipolygon_with_line(self):
                # two polygons with a crossing line --> return 4 triangles
-               poly1 = Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) 
+               poly1 = Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)])
                poly2 = Polygon([(1, 1), (1, 2), (2, 2), (2, 1), (1, 1)])
                mpoly = MultiPolygon([poly1, poly2])
                ls = LineString([(-1, -1), (3, 3)])
                self.helper(mpoly, ls, 4)
 
                # two polygons away from the crossing line --> return identity
-               poly1 = Polygon([(10, 10), (10, 11), (11, 11), (11, 10), (10, 
10)]) 
+               poly1 = Polygon([(10, 10), (10, 11), (11, 11), (11, 10), (10, 
10)])
                poly2 = Polygon([(-10, -10), (-10, -11), (-11, -11), (-11, 
-10), (-10, -10)])
                mpoly = MultiPolygon([poly1, poly2])
                ls = LineString([(-1, -1), (3, 3)])
-               self.helper(mpoly, ls, 2)
\ No newline at end of file
+               self.helper(mpoly, ls, 2)

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

_______________________________________________
Pkg-grass-devel mailing list
Pkg-grass-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-grass-devel

Reply via email to