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

visibility into projection? #158

Open
fsiler opened this issue Aug 19, 2018 · 3 comments
Open

visibility into projection? #158

fsiler opened this issue Aug 19, 2018 · 3 comments
Assignees

Comments

@fsiler
Copy link

fsiler commented Aug 19, 2018

Hello,
I'm reading some inputs which are in projections EPSG:26796 and ESRI:102696. I noticed that ogrinfo and ogr2ogr have some awareness of these and can tell me about them and even automatically convert to other projections when warranted. I had a look through the pyshp code (eg shapefile.Reader._Reader__dbfHeader()), and I don't find a way to inspect or even a hook for where I might get started to find this out. Any chance of a patch to provide something like a shapefile.Reader.projection field?

@micahcochran
Copy link
Contributor

The shapefile projection information is stored in the .prj file, which is in Well Known Text (WKT) format. Having some way to easily gain access the the .prj file might be a good feature.

In order to reproject this, you could use pyCRS to convert the WKT format to a PROJ.4 string. Then you could use pyproj to reproject the data. However, pyshp seems to be a very slim API that doesn't try to do everything for you. If a feature like this added, the requirements should be optional.

@karimbahgat
Copy link
Collaborator

Agree, that would be a good feature. I guess we could just read it in the same way we read the shp, shx, and dbf files, and remember to close it as well.
What would be a good way to access it, maybe storing it as a string in a .proj attribute?

@micahcochran
Copy link
Contributor

Fiona has a .crs attribute documented (coordinate reference system) , but that is for the dictionary of the PROJ.4 projection string.

Fiona also has a less documented .crs_wkt attribute, which give the WKT representation. (Behind the scenes it calls the underlying OGR for this info, through get_crs_wkt().)

I don't have a strong opinion on the naming.

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

No branches or pull requests

3 participants