On Mar 18, 2010, at 9:27 PM, Ben Hesketh wrote:
Hi,
I have a Polygon that if I buffer returns an empty polygon.
The polygon is valid and simple.
Am I doing something weird or is this a bug?
I've used a negative buffer on lots of other polygons without any
problems
Ubuntu 9.10
libgeos_c1 3.1.1.1~jaunty1
shapely 1.2b3 (according to shapely.__path__)
Code:
>>> str = "POLYGON ((-122.4153561260444860 37.7202188031237853,
-122.4272999999999882 37.7150999999999996, -122.4308999999999941
37.7159999999999940, -122.4326999999999828 37.7132999999999967,
-122.4332999999999885 37.7126999999999981, -122.4407999999999959
37.7162999999999968, -122.4320999999999913 37.7276999999999987,
-122.4284999999999854 37.7312999999999974, -122.4281999999999897
37.7318999999999960, -122.4230999999999909 37.7312999999999974,
-122.4212999999999880 37.7315999999999931, -122.4153561260444860
37.7321943873955519, -122.4153561260444860 37.7202188031237853))"
>>> p1 = wkt.loads(str)
>>> p1
<shapely.geometry.polygon.Polygon object at 0xb75b446c>
>>> p2 = p1.buffer(-0.0001)
>>> p2
<shapely.geometry.polygon.Polygon object at 0xb75b42ac>
>>> print p2
POLYGON EMPTY
>>> p1.is_valid
True
>>> p1.is_simple
True
>>>
Thanks,
Ben Hesketh
--
Co-founder, Compass Engine
http://compassengine.com
Hi Ben,
I remember that there were buffering bugs reported around GEOS 3.1.
I'm using 3.2 here (OS X) and can't reproduce your problem:
>>> x = loads("POLYGON ((-122.4153561260444860
37.7202188031237853, ...")
>>> print x.buffer(-0.0001)
POLYGON ((-122.4154561260444893 37.7202847427395866, ...)
>>> print x.buffer(-0.001)
POLYGON ((-122.4276213654393075 37.7308250287123528, ...)
>>> print x.buffer(-0.01)
POLYGON EMPTY
Around that value, the negative buffering produces a properly
vanishing (empty) figure. What you're reporting seems like a bug to me.
--
Sean
_______________________________________________
Community mailing list
[email protected]
http://lists.gispython.org/mailman/listinfo/community