pyproj icon indicating copy to clipboard operation
pyproj copied to clipboard

ENH: allow to check for specific WKT flavor in the is_wkt() function

Open jorisvandenbossche opened this issue 2 years ago • 2 comments

There is a is_wkt function that allows you to check if a given string is a WKT string:

https://github.com/pyproj4/pyproj/blob/2d3cc7e0b83f59df2c0f5d3c2a8446ce0f224700/pyproj/_crs.pyx#L32-L48

The proj method it is using for that (proj_context_guess_wkt_dialect) should also allow to check for an exact flavor. So there could be an optional version keyword, to allow something like is_wkt(..., version="WKT2_2019")?

jorisvandenbossche avatar Mar 06 '22 08:03 jorisvandenbossche

Yes, that is possible to check for a specific version: https://proj.org/development/reference/datatypes.html#c.PJ_GUESSED_WKT_DIALECT

Another alternative could be to add a new function that returns the WKT version.

snowman2 avatar Mar 06 '22 12:03 snowman2

Thoughts on adding a new method called something like guess_wkt_version that returns the WktVersion or None if it is not a WKT?

snowman2 avatar Aug 25 '22 13:08 snowman2