Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interest in I/O methods interfacing geopandas objects? #270

Open
martinfleis opened this issue Apr 28, 2024 · 3 comments
Open

Interest in I/O methods interfacing geopandas objects? #270

martinfleis opened this issue Apr 28, 2024 · 3 comments

Comments

@martinfleis
Copy link

Hi all,

a while ago, when we considered providing pure Python I/O in GeoPandas, I have drafted read and write functions to and from GeoDataFrames to shapefile using pyshp. We decided not to go that way in the end but I was wondering if you might be interested in including it here before I'll simply dump it to a Gist and forget about it.

You can check the implementation here geopandas/geopandas#1580 . It may be a little dated but should likely work. I am happy to turn it into a PR if you consider it worthwhile, but I am also happy to let it go.

@JamesParrott
Copy link
Collaborator

JamesParrott commented May 2, 2024

Thanks for this Martin.

Is the essence of it the two read and write functions in the attached file?

It pulls in pyproj and chardet, but the encoding fallback and cpg support would be useful - (issue #247 requested support for cpg files).

PyShp shouldn't pull in geopandas by default, so It'd need an optional extra install on PyPi. PyShp's setup.py is a nice simple two liner at the moment.

The functions are well worth putting on a branch though, as people can install that straight from github with pip now.

PyShp_read_write_Geodataframe.zip

@JamesParrott
Copy link
Collaborator

I've thrown this together (and have not tested it):

https://github.com/JamesParrott/IronPyShp/tree/PyShp-read-write-Geopandas-DFs

@martinfleis
Copy link
Author

Is the essence of it the two read and write functions in the attached file?

Yes, it should work in the same way you included it in https://github.com/JamesParrott/IronPyShp/tree/PyShp-read-write-Geopandas-DFs. Might need minor touches to accommodate for the latest API changes here and there but I don't expect much.

It pulls in pyproj and chardet
PyShp shouldn't pull in geopandas by default

Agree, all those shall be soft-dependencies here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants