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

Add .prj file to new_known_crs doc #216

Open
nk9 opened this issue Jan 13, 2025 · 7 comments
Open

Add .prj file to new_known_crs doc #216

nk9 opened this issue Jan 13, 2025 · 7 comments

Comments

@nk9
Copy link
Contributor

nk9 commented Jan 13, 2025

The docs for new() and new_known_crs() describe several different string formats accepted for creating a new projection pipeline. These are the options listed in new_known_crs():

  • an "AUTHORITY:CODE", like "EPSG:25832".
  • a PROJ string, like "+proj=longlat +datum=WGS84". When using that syntax, the unit is expected to be degrees.
  • the name of a CRS as found in the PROJ database, e.g "WGS84", "NAD27", etc.
  • more generally, any string accepted by new()

new() actually lists fewer options, and nothing beyond the bulleted list above.

I had a set of Shapefile files that I wanted to grab the projection from, but all I had was the .prj file. I didn't see that format listed in the docs, but I had nothing to lose so I tried just passing that to new_known_crs() and… it worked! For clarity, here's what my .prj looks like:

GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]

I think this is a pretty common thing that people would want to do. Just checking that this behavior is expected, and if you'd accept a PR to add this to the docs as another bullet point in new_known_crs().

@lnicola
Copy link
Member

lnicola commented Jan 13, 2025

Did you pass in the file name or contents?

@nk9
Copy link
Contributor Author

nk9 commented Jan 13, 2025

The full contents of the file. The whole string provided there.

@lnicola
Copy link
Member

lnicola commented Jan 13, 2025

That's called WKT and it's a very popular representation of projections. We call proj_create, see here for what it accepts.

@nk9
Copy link
Contributor Author

nk9 commented Jan 13, 2025

Oh, that's really useful! I would suggest adding WKT to that bulleted list, with an example, and also providing that link instead of pointing to new(). Happy to submit a PR for this change.

@lnicola
Copy link
Member

lnicola commented Jan 13, 2025

I'd prefer reproducing (more or less exactly) the list from the proj_create docs.

@nk9
Copy link
Contributor Author

nk9 commented Jan 13, 2025

OK, that's fine. Would you like to put the full list in new() and point there from new_known_crs()? And remove the current list from new_known_crs()?

@lnicola
Copy link
Member

lnicola commented Jan 13, 2025

Yeah, sounds good. The other one calls https://proj.org/en/stable/development/reference/functions.html#c.proj_create_crs_to_crs, you can use that.

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