You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sedona.apache.org by "ump45nose (via GitHub)" <gi...@apache.org> on 2026/10/23 23:05:46 UTC
[PR] feat(rust/sedona-raster): abbreviate PROJJSON and WKT CRSes in raster display [sedona-db]
ump45nose opened a new pull request, #1493:
URL: https://github.com/apache/sedona-db/pull/1493
## Summary
`RasterDisplay` (used by `SD_Format`) currently prints a raster's CRS verbatim, except that any PROJJSON CRS is collapsed to `{...}`. That means a PROJJSON CRS with an `id` (e.g. the one we write for `OGC:CRS84`) shows up as `{...}`, and a WKT CRS is printed in full.
This parses the CRS with `sedona_schema::crs::deserialize_crs()` and prints its authority code when it has one:
- authority codes (`EPSG:32618`, `OGC:CRS84`) are still printed as-is;
- PROJJSON with an `id` prints that id (e.g. `EPSG:4269`);
- WKT with a trailing `ID[...]` / `AUTHORITY[...]` prints that code;
- PROJJSON or WKT without an authority code prints `{...}`, as PROJJSON did before;
- strings that don't parse are printed as before (verbatim, or `{...}` if they start with `{`).
The format of the rest of the output (which was the other part of the issue) was already done, so this only changes the CRS part.
Closes #639.
## Testing
New tests in `rust/sedona-raster/src/display.rs` cover an authority code, no CRS, `OGC_CRS84_PROJJSON`, a NAD83 PROJJSON with an id, PROJJSON without an id, and WKT with and without an `ID[...]`.
`cargo test -p sedona-raster` (232 tests) and `cargo test -p sedona-functions sd_format` pass, and `cargo clippy -p sedona-raster --all-targets -- -D warnings` and `cargo fmt` are clean.
This PR was prepared with AI assistance; I reviewed the change and ran the tests above.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(rust/sedona-raster): abbreviate PROJJSON and WKT CRSes in raster display [sedona-db]
Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot commented on code in PR #1493:
URL: https://github.com/apache/sedona-db/pull/1493#discussion_r4373618563
##########
rust/sedona-raster/src/display.rs:
##########
@@ -112,11 +111,32 @@ impl fmt::Display for RasterDisplay<'_> {
}
}
+/// Write a compact form of a raster's CRS string
+///
+/// The CRS is written as its authority code where one is available: authority
+/// codes (e.g., `EPSG:32618`) are written verbatim, and PROJJSON or WKT
+/// definitions are written as the authority code they carry (the `id` of a
+/// PROJJSON object or the trailing `ID[...]`/`AUTHORITY[...]` of a WKT string).
+/// Definitions without an authority code are written as `{...}`.
+fn write_abbreviated_crs(f: &mut fmt::Formatter<'_>, crs: &str) -> fmt::Result {
+ match deserialize_crs(crs) {
+ Ok(Some(parsed)) => match parsed.to_authority_code() {
+ Ok(Some(auth_code)) => write!(f, "{auth_code}"),
+ _ => write!(f, "{{...}}"),
+ },
Review Comment:
Can we use the existing `Display` for CRSes here?
```suggestion
Ok(Some(parsed)) => write!(f, "{parsed}"),
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(rust/sedona-raster): abbreviate PROJJSON and WKT CRSes in raster display [sedona-db]
Posted by "ump45nose (via GitHub)" <gi...@apache.org>.
ump45nose commented on code in PR #1493:
URL: https://github.com/apache/sedona-db/pull/1493#discussion_r4373679682
##########
rust/sedona-raster/src/display.rs:
##########
@@ -112,11 +111,32 @@ impl fmt::Display for RasterDisplay<'_> {
}
}
+/// Write a compact form of a raster's CRS string
+///
+/// The CRS is written as its authority code where one is available: authority
+/// codes (e.g., `EPSG:32618`) are written verbatim, and PROJJSON or WKT
+/// definitions are written as the authority code they carry (the `id` of a
+/// PROJJSON object or the trailing `ID[...]`/`AUTHORITY[...]` of a WKT string).
+/// Definitions without an authority code are written as `{...}`.
+fn write_abbreviated_crs(f: &mut fmt::Formatter<'_>, crs: &str) -> fmt::Result {
+ match deserialize_crs(crs) {
+ Ok(Some(parsed)) => match parsed.to_authority_code() {
+ Ok(Some(auth_code)) => write!(f, "{auth_code}"),
+ _ => write!(f, "{{...}}"),
+ },
Review Comment:
Done in 2a4013e, thanks! It now uses the CRS `Display` impl. Since that lowercases authority codes, the existing raster display and `SD_Format` tests now expect `ogc:crs84`; I updated those too.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(rust/sedona-raster): abbreviate PROJJSON and WKT CRSes in raster display [sedona-db]
Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot merged PR #1493:
URL: https://github.com/apache/sedona-db/pull/1493
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org