Just one opinion:

I agree that what you describe is [philosophically] "wrong".  It is 
understandable if the LinearRing is implemented (under the covers) as a 
LineString that has the same point as both endpoints.

But, topologically, the LinearRing is NOT that; it has no "boundary", just and 
interior and an exterior.

Other thoughts?

Fabien: as a quick fix, I think you might be able to use 
shapely.ops.linemerge() or shapely.ops.cascaded_union().



-----Original Message-----
From: community-boun...@lists.gispython.org 
[mailto:community-boun...@lists.gispython.org] On Behalf Of Fabien
Sent: Tuesday, January 20, 2015 4:09 AM
To: community@lists.gispython.org
Subject: [Community] Shapely: LinearRing intersections with polygons

Hi All,

LinearRing behaves differently when interecting at the "junction point", see 
example below:

 >>> from shapely.geometry import *
 >>> coords = [(1,1), (0,1), (0,2), (1,2), (3,2), (3,1), (1,1)]  >>> 
 >>> print(Point(1.0, 1.0).buffer(0.4).intersection(LinearRing(coords)))
MULTILINESTRING ((1 1, 0.6 1), (1.4 1, 1 1))

These are the two "sides" of the junction.

Anywhere else on the ring, a simple line is returned as expected:

 >>> print(Point(2.0, 2.0).buffer(0.4).intersection(LinearRing(coords)))
LINESTRING (1.6 2, 2.4 2)

Is this a bug or is it expected? What makes me think it is a bug is that with 
Polygons, a single polgon is returned and not a MultiPolygon:

 >>> print(Point(1.0, 1.0).buffer(0.4).intersection(Polygon(coords)))
POLYGON ((0.6 ...

Any idea? Thanks!

Fabien

_______________________________________________
Community mailing list
Community@lists.gispython.org
http://lists.gispython.org/mailman/listinfo/community
_______________________________________________
Community mailing list
Community@lists.gispython.org
http://lists.gispython.org/mailman/listinfo/community

Reply via email to