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

ENH: Use shapefile crs attribute when possible #2307

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

greglucas
Copy link
Contributor

@greglucas greglucas commented Dec 24, 2023

When reading in the shapefile, use the .prj file information if it is present to set a crs attribute on the reader which can be used down the line by features to get the correct Projection.

Somewhat interesting that loading the wkt from the file produces a different CRS than the one going through Fiona's CRS first... I'm not sure if that is expected or not, so opening this PR as a draft for now.

closes ##906
closes #2289

@dopplershift
Copy link
Contributor

Seems really odd that those would be different.

When reading in the shapefile, use the .prj file information
if it is present to set a crs attribute on the reader which
can be used down the line by features to get the correct
Projection.
@greglucas greglucas marked this pull request as ready for review October 23, 2024 20:23
@greglucas
Copy link
Contributor Author

I just pushed an update that puts the same logic into each of the readers so there isn't any difference between FionaReader and BasicReader in how you get a WKT and we rely on pyproj's version to decode the .prj file if it is present.

@dopplershift
Copy link
Contributor

Not sure what's up with CI.

@greglucas greglucas marked this pull request as draft October 24, 2024 13:15
@greglucas
Copy link
Contributor Author

I'm going to move this back to draft for now so it doesn't get merged.

The docs failures are real and I assume due to an interaction of this new CRS for NaturalEarth and the handling updated in #2455
I can reproduce it with a local docs build, but just running the examples manually as a script works fine. I'm not sure what specific figure size and other options sphinx_gallery uses, but my guess is there is some different settings in there that cause the error to show up.

The other thing I noticed looking through the logs is that we have a lot of UserWarnings now:

UserWarning: Approximating coordinate system <Geographic 2D CRS: GEOGCRS["WGS 84",DATUM["World Geodetic System 1984 ...>
Name: WGS 84
Axis Info [ellipsoidal]:
- lon[east]: Longitude (Degree)
- lat[north]: Latitude (Degree)
Area of Use:
- undefined
Datum: World Geodetic System 1984
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
 with the PlateCarree projection.

which means that UserWarning gets printed a lot because it is associated with every natural earth feature now.

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

Successfully merging this pull request may close these issues.

NaturalEarthFeature is hard-coded to PlateCarree()
2 participants