> On Wed, Jun 27, 2012 at 7:46 PM, Stefano Costa <[email protected]> wrote: >> >> Il 27/06/2012 18:25, Sean Gillies ha scritto: >>> Have you looked at my Python geospatial data protocol doc? >>> https://gist.github.com/2217756 >>> This would be a more general and less Shapely-dependent way to >>> represent geometries, if you like. >> >> Especially considered that the library is otherwise pure Python, I >> would second Sean's suggestion. >> or it's rather better to implement to protocol from scratch.
>> I have nothing against Shapely of course, but its dependency on GEOS >> makes it more complicated to install with modern Python packaging >> tools like pip. It turned out that I was using more of shapelys functionality than geojson could provide so I had to implement the protocol from scratch For your convenience i factored it out into a package of its own so if you have to scratch a similar itch you do not have to start all over again: https://github.com/cleder/pygeoif (pygeoif for a want of a better name) You may think of pygeoif as a 'shapely ultralight' which lets you construct geometries and perform _very_ basic operations like reading and writing geometries to WKT, constructing line strings out of points, polygons from linear rings, multi polygons from polygons, etc. It was inspired by shapely and implements the geometries in a way that when you are familiar with shapely you feel right at home with pygeoif (actually most of the docstrings were copied from shapely and just adjusted to reflect the differences, also the __geo_interface__ is basically a verbatim copy of shapelys implementation) The tests https://github.com/cleder/pygeoif/blob/master/pygeoif/tests.py give you an overview what can be done with this package. It is unfinished and early alpha but already usable (fastkml works fine with it), release often, release early ;) It is GPL licensed but i am open for suggestions, so if you need another license (or think this infringes with code i copied from shapely) drop me a line So far I only tested with python 2 but it _should_ work with python 3, the code is pretty straight forward and written with simplicity and readability in mind (so no magic adapters or version specific stuff, wysiwyg) -- Best Regards, Christian Ledermann Nairobi - Kenya Mobile : +254 702978914 <*)))>{ If you save the living environment, the biodiversity that we have left, you will also automatically save the physical environment, too. But If you only save the physical environment, you will ultimately lose both. 1) Don’t drive species to extinction 2) Don’t destroy a habitat that species rely on. 3) Don’t change the climate in ways that will result in the above. }<(((*> _______________________________________________ Community mailing list [email protected] http://lists.gispython.org/mailman/listinfo/community
