New PyShp fork at GitHub: Reads shapefiles much faster, and can write new shapes based on geojson

93 views
Skip to first unread message

Karim Bahgat

unread,
Jan 15, 2014, 9:56:21 PM1/15/14
to geospati...@googlegroups.com
Hi everyone,

Just thought I would share with everyone that I have just created a new fork of the PyShp library with some nice new features at: 
https://github.com/karimbahgat/pyshp-fork-speedup-and-geojson-write
Curious to see what you all may think about the changes, which include:

1) General speedup for reading shapefile geometries (x1.5 faster).

2) Potentially drastic reading speedup if user has Numpy (x5.5 faster). Simply set the new "numpyspeed" option to True when using the "iterShapes" or "shape" methods of the Reader class.

3) Write shapes based on geojson input which makes it possible to RECEIVE shapes/results from modules like Shapely (previously it was only possible to SEND shapes to other modules). Simply use the new writer.write_geoj(geojdict) method.

4) Added an iterShapeRecords method to iterate through both shapes and records at the same time (similar to a request and suggestion by another user, see issue 58 under the "Issues" tab of the original code website).

I really wanted to add them as suggestions/commits to the original code, but wasn't sure how to do that so just created a temporary fork at GitHub. I was hoping and interested to see if the author J. Lawhead could check out the fork and see what he thinks of merging in some of the changes to the next version if he likes or agrees to them. 

Only feature that might need a tad more testing is the GeoJson to PyShp converter, have only tested it on polygons so far, not on lines and points. There also ends up being some mixing of tuples and lists but not yet sure if that is problematic or not and if should be changed... 

Bear in mind that I'm new to GitHub and that this is my first fork, so not sure if I have gone about this the right way. 

Thanks in advance for any thoughts/feedback/questions/suggestions. 

Karim
Reply all
Reply to author
Forward
0 new messages