[Community] GeometryCollections with multiple polygons
Harasty, Daniel J
dharasty at appcomsci.com
Mon Mar 5 18:44:52 EET 2012
Sean:
You mentioned:
> I'm reluctant to make heterogeneous geometry collections first-class objects in Shapely,
> mostly because GEOS (the lib under Shapely) generally disallows any operations on them.
> For what it's worth, Shapely will happily write invalid multipolygons to WKT....
> Thanks to the design of WKT, it's trivial to serialize a list of geometries to WKT like this:
> "GEOMETRYCOLLECTION (%s)" % ", ".join(g.wkt for g in geometries)
> Will that get you by?
Thanks! The second tip (doing the "GEOMETRYCOLLECTION".join([...])) was my "fallback plan".
I'll investigate the "intentional invalid Multipolygon" trick, too.
I do need to be able to read and reconstitute whatever serialization I choose (in Python with Shapely), so I'll have to make sure that Shapely can "round trip" either of those options. Also, I do have the additional requirements that whatever I create has to be readable/bufferable by our system's SQL server.
If either of the above work, then I'm good.
Thanks again,
Dan
More information about the Community
mailing list