Add .prj file to `new_known_crs` doc
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().
Did you pass in the file name or contents?
The full contents of the file. The whole string provided there.
That's called WKT and it's a very popular representation of projections. We call proj_create, see here for what it accepts.
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.
I'd prefer reproducing (more or less exactly) the list from the proj_create docs.
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()?
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.