paleolimbot / wk

Lightweight Well-Known Geometry Parsing
https://paleolimbot.github.io/wk
Other
47 stars 7 forks source link

Add vec_equal support to wk_wkb vectors #183

Closed anthonynorth closed 1 year ago

anthonynorth commented 1 year ago

Adds vctrs::vec_equal() support for wk_wkb vectors.

Closes #181

codecov-commenter commented 1 year ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (e3d4efb) 99.03% compared to head (ca53871) 99.03%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #183 +/- ## ======================================= Coverage 99.03% 99.03% ======================================= Files 81 81 Lines 5888 5918 +30 ======================================= + Hits 5831 5861 +30 Misses 57 57 ``` | [Impacted Files](https://app.codecov.io/gh/paleolimbot/wk/pull/183?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Dewey+Dunnington) | Coverage Δ | | |---|---|---| | [src/init.c](https://app.codecov.io/gh/paleolimbot/wk/pull/183?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Dewey+Dunnington#diff-c3JjL2luaXQuYw==) | `100.00% <ø> (ø)` | | | [R/pkg-vctrs.R](https://app.codecov.io/gh/paleolimbot/wk/pull/183?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Dewey+Dunnington#diff-Ui9wa2ctdmN0cnMuUg==) | `100.00% <100.00%> (ø)` | | | [R/wkb.R](https://app.codecov.io/gh/paleolimbot/wk/pull/183?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Dewey+Dunnington#diff-Ui93a2IuUg==) | `93.33% <100.00%> (+0.15%)` | :arrow_up: | | [src/vctr.c](https://app.codecov.io/gh/paleolimbot/wk/pull/183?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Dewey+Dunnington#diff-c3JjL3ZjdHIuYw==) | `100.00% <100.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

anthonynorth commented 1 year ago

Is it worth exposing the "convert to hex" in any other way? It is probably useful in other contexts as well...maybe wkb_to_hex() or something?

It could be useful. I can add wkb_to_hex to this PR, or a separate PR if you'd like me to do it.

anthonynorth commented 1 year ago

Should 2 identical features with different endianness be considered equal? Should vctrs::vec_order(wkb) be endian-dependent (which it currently is)?

# remotes::install_github("paleolimbot/wk#183")
library(wk)

points <- wkt(c("POINT (1 1)", "POINT (2 2)"))
points_le <- wk_handle(points, wkb_writer(endian = 1))
points_be <- wk_handle(points, wkb_writer(endian = 0))

vctrs::vec_equal(points_le, points_be)
#> [1] FALSE FALSE
vctrs::vec_order(points_le) == vctrs::vec_order(points_be)
#> [1] FALSE FALSE

Created on 2023-07-11 with reprex v2.0.2

anthonynorth commented 1 year ago

I've exported wkb_to_hex() -- but I haven't rebuilt package documentation.

paleolimbot commented 1 year ago

Thanks! (FWIW, it's usually good practice to rebuild the documentation yourself)