Skip to content

Define print for GeoFormat types - #55

Merged
evetion merged 2 commits into
mainfrom
print-geoformat
Sep 17, 2026
Merged

evetion merged 2 commits into
mainfrom
print-geoformat

Conversation

@evetion

@evetion evetion commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

string and print on GeoFormat types fell back to the two-argument show, giving the constructor form, e.g. string(EPSG(4326)) == "EPSG{1}((4326,))". This leaked into files written by GeoArrow.jl (JuliaGeo/GeoArrow.jl#10).

  • print on any GeoFormat prints val(x), so WKT, PROJ strings, GML, KML etc. give their contents.
  • print on EPSG prints convert(String, x): string(EPSG(4326, 3855)) == "EPSG:4326+3855", which EPSG(::String) parses back.
  • print on a WellKnownBinary holding AbstractVector{UInt8} prints hex (bytes2hex), readable with hex2bytes. Other value types fall back to val.
  • repr and the text/plain display are unchanged.

Round trips are tested with real WKT, WKT2 and WKB. The mode (Geom/CRS) is not part of the string, so it has to be passed again when reconstructing. ProjJSON/GeoJSON holding a Dict print the Dict, as there is no JSON dependency.

This changes string interpolation of these types, e.g. in error messages ("CRS $crs").

🤖 Generated with Claude Code

evetion and others added 2 commits September 17, 2026 11:25
string and print now return the wrapped value ("EPSG:4326" for EPSG)
instead of the constructor form. repr is unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@evetion
evetion requested a review from asinghvi17 September 17, 2026 09:35
@asinghvi17

Copy link
Copy Markdown
Member

ProjJSON should be jsonified somehow? But otherwise makes sense.

@evetion

evetion commented Sep 17, 2026

Copy link
Copy Markdown
Member Author

ProjJSON should be jsonified somehow? But otherwise makes sense.

Yeah that would require a JSON ext?

@evetion
evetion merged commit fdddaa4 into main Sep 17, 2026
12 checks passed
@evetion
evetion deleted the print-geoformat branch September 17, 2026 09:56
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

Successfully merging this pull request may close these issues.

2 participants