Opened 3 days ago

Last modified 3 days ago

#150 new defect

[Cavern][*cs] Support for WKT2 for proj

Reported by: Philip Schuchardt Owned by: Olly Betts
Priority: minor Milestone:
Component: Other Version:
Keywords: Cc:

Description

I need custom WKT2 strings for CaveWhere to properly use plate-fixed datums with custom tmerc projection.

*cs ... CUSTOM "..." accepts any string PROJ's proj_create() understands, but the .svx string reader cannot represent a " inside a quoted string, and WKT2 is made of them. That leaves a class of coordinate systems that cavern cannot be told about at all: a custom projection on a datum newer than PROJ's +datum= table.

PROJ has deprecated the proj-string form for describing a CRS. From proj.h (proj_as_proj_string, PROJ 9.8.1):

Reproduction

Survex 1.4.15, PROJ 9.8.1, macOS (Homebrew). Attached: wkt.zip, containing the files below plus mkldp.c, which generates the CRS with the PROJ C API and prints both serializations.

projstring.svx — control, works (exit 0, writes .3d), but the frame it georeferences to has no datum:

*cs EPSG:6318
*cs out CUSTOM "+proj=tmerc +lat_0=37.1866 +lon_0=-86.1005 +k=1 +x_0=0 +y_0=0 +ellps=GRS80 +units=m +no_defs +type=crs"

*fix entrance -86.1005 37.1866 200

entrance a 30.0 090 -05
a        b 25.0 135 +02

wkt2.svx — the same CRS as single-line WKT2:2019 (proj_as_wkt(..., PJ_WKT2_2019, {"MULTILINE=NO"})). Exit 1, no .3d:

wkt2.svx:2:16: error: Unknown coordinate system
 *cs out CUSTOM "PROJCRS["Mammoth Cave LDP",BASEGEOGCRS["NAD83(2011)",DATUM[...
                ^~~~~~~~~~~~~~~~~
wkt2.svx:4: error: The input projection is set but the output projection isn't

Neither escaping convention helps, and the two fail differently:

file form result
wkt2.svx raw " error 434 Unknown coordinate system
wkt2-backslash.svx \" error 434 Unknown coordinate system
wkt2-doubled.svx "" error 443 Invalid coordinate system: Invalid PROJ string syntax
wkt2-unquoted.svx no quoting error 443 Invalid coordinate system: Invalid PROJ string syntax

Attachments (2)

wkt.zip (4.7 KB ) - added by Philip Schuchardt 3 days ago.
0001-cavern-Allow-cs-custom-to-read-the-CRS-from-a-file.patch (19.1 KB ) - added by Philip Schuchardt 3 days ago.

Download all attachments as: .zip

Change History (4)

by Philip Schuchardt, 3 days ago

Attachment: wkt.zip added

comment:1 by Philip Schuchardt, 3 days ago

I'm working on a patch for this.

comment:2 by Philip Schuchardt, 3 days ago

Patch is attached.

Note: See TracTickets for help on using tickets.