[Community] cascaded_union failure : No Shapely geometry can be created from null value
sean.gillies at gmail.com
Fri Jun 25 14:04:36 EEST 2010
GEOS 3.2.2 should be fine.
On Fri, Jun 25, 2010 at 12:52 PM, Emmanuel Lambert
<emmanuel.lambert at intec.ugent.be> wrote:
> Hello Sean
> Thanks for you reply. I was also just about to add a follow-up comment.
> I upgraded my system to GEOS 3.2.2 (compile from source) and apparently
> that solved the problem. So I guess it was an issue of libgeos.
> Can I assume that Shapely 1.2.1 works fine with GEOS 3.2.2 ?
> I experience no issues at this time, but would appreciate your feedback
> on this.
> On Fri, 2010-06-25 at 12:46 +0200, Sean Gillies wrote:
>> 2010/6/24 Emmanuel Lambert <emmanuel.lambert at intec.ugent.be>:
>> > Hi,
>> > Attached is a list of polygons in WKT format.
>> > I have a MultiPolygon consisting of these polygons.
>> > The cascaded_union function failes on this multipolygon.
>> > "ValueError: No Shapely geometry can be created from null value"
>> > Script to reproduce the problem :
>> > from shapely.wkt import loads
>> > from shapely.geometry import Polygon,MultiPolygon
>> > from shapely.ops import cascaded_union
>> > f = open('MULTIPOLYGON.TXT','r')
>> > polygons = 
>> > while True:
>> > wkt = f.readline().replace("\n","")
>> > print wkt
>> > if len(wkt)==0:
>> > break
>> > pol = loads(wkt)
>> > polygons.append(pol)
>> > mp = MultiPolygon(polygons)
>> > up = cascaded_union(mp)
>> > I have tried several strategies to work around it, but cannot get to a
>> > solution. Is this a bug in shapely, or is something wrong with my data?
>> > Your advice would be appreciated.
>> > (Shapely 1.2.1)
>> > Thanks,
>> > Emmanuel
>> Hi Emmanuel,
>> Before I try to reproduce this, can you run the script again and
>> assert that each polygon is valid within the loop?
>> pol = loads(wkt)
>> assert pol.is_valid
More information about the Community