tarsh / pyshp

Automatically exported from code.google.com/p/pyshp
MIT License
0 stars 0 forks source link

New feature: Easy function to add GeoJson shape objects and write/save to new file #62

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

While the __geo_interface__ property was very useful to be able to convert from 
pyshp shape to geojson in order to send shapes over to modules like Shapely for 
geometric operations like intersect or union, I found this to be limited 
because there was no easy way to retrieve the results back into Pyshp for 
saving. 

I therefore added a new complementary feature to the __geo_interface__ 
property, a function that does the opposite by taking a geojson dictionary 
object and converting it to the appropriate pyshp shape object so it can be 
easily added to the Writer class for saving. 

This was one of several nifty changes/new features to your (already awesome) 
library I made in a new fork at 

https://github.com/karimbahgat/pyshp-fork-speedup-and-geojson-write

Hope this can be worked into next version of PyShp. I think this change would 
bring your library one step closer to be the backbone of a pure-python spatial 
analysis environment. PyShp, Shapely, and optionally rTree become quite the 
unstoppable team with this feature enabled, making it real easy to read, 
manipulate, create new shapes, and most importantly save them back to file. 

Karim

Original issue reported on code.google.com by karim.ba...@gmail.com on 16 Jan 2014 at 2:11