Skip to content

visibility into projection? #158

Open

Description

@fsiler

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?

Activity

  1. micahcochran commented on Aug 20, 2018

    @micahcochran
    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.

  2. karimbahgat commented on Aug 28, 2018

    @karimbahgat
    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?

  3. self-assigned this
    on Aug 28, 2018
  4. micahcochran commented on Aug 29, 2018

    @micahcochran
    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

Metadata

Metadata

Assignees

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions