On Thu, Dec 16, 2010 at 4:41 PM, Charles Schmidt <[email protected]> wrote: >>> -----Original Message----- >>> From: community-bounces at lists.gispython.org >>> [mailto:community-bounces at lists.gispython.org] On Behalf Of >>> Robert Sanson >>> Sent: Wednesday, 08 December 2010 15:49 >>> To: gispython.org community projects >>> Subject: [Community] PySAL and Shapely >>> >>> Is there anyone who has worked with both Shapely and PySAL ( >>> http://geodacenter.asu.edu/pysal )? >>> >>> I'm wondering what it would take to get the respective >>> geometries to interact with each other? In other words use >>> methods and functions from both libraries on the same geometries. >>> >> >> Seems that both libs know how to talk WKT at the least, which you could >> use to pass between them. >> >> ..Tom > > Hello, > I'm a developer on the PySAL project. Currently PySAL only supports reading > WKT, not writing. The simplest option might be to write your geometry out to > a shapefile and read it back in with the other library. > The shape objects in pysal are relatively simple and the source is well > documented. For Polygons, the vertices are stored in to 2 lists, > Polygon.parts and Polygon.holes. Polygon.vertices will return both, but be > warned both the parts and holes will be in clockwise order. > - Charlie.
Round tripping through a shapefile won't work in this case and adds needless I/O. What could be handy for PySAL is methods to read and write GeoJSON-like Python dicts. This would allow all kinds of interoperability. Shapely does it (http://gispython.org/shapely/docs/1.2/manual.html#shapely.geometry.mapping), ArcPy does it, and I've seen it in the SimpleGeo Python APIs. -- Sean _______________________________________________ Community mailing list [email protected] http://lists.gispython.org/mailman/listinfo/community
