2010/6/24 Emmanuel Lambert <[email protected]>:
> 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
polygons.append(pol)
--
Sean
_______________________________________________
Community mailing list
[email protected]
http://lists.gispython.org/mailman/listinfo/community