Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utm_convert() drops tbl class #143

Open
ateucher opened this issue Jan 30, 2024 · 0 comments
Open

utm_convert() drops tbl class #143

ateucher opened this issue Jan 30, 2024 · 0 comments

Comments

@ateucher
Copy link
Collaborator

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(bcmaps)
#> Loading required package: sf
#> Linking to GEOS 3.11.0, GDAL 3.5.3, PROJ 9.1.0; sf_use_s2() is TRUE
#> Support for Spatial objects (`sp`) was removed in {bcmaps} v2.0.0. Please use `sf` objects with {bcmaps}.

tbl <- dplyr::tibble(
  a = "a",
  zone = 10,
  easting = 321123,
  northing = 5555555
)
tbl
#> # A tibble: 1 × 4
#>   a      zone easting northing
#>   <chr> <dbl>   <dbl>    <dbl>
#> 1 a        10  321123  5555555
class(tbl)
#> [1] "tbl_df"     "tbl"        "data.frame"

out <- utm_convert(tbl, "easting", "northing", "zone")

out
#> Simple feature collection with 1 feature and 6 fields
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: 1035564 ymin: 567840.9 xmax: 1035564 ymax: 567840.9
#> Projected CRS: NAD83 / BC Albers
#>    a zone       X        Y easting northing                 geometry
#> 10 a   10 1035564 567840.9  321123  5555555 POINT (1035564 567840.9)
class(out)
#> [1] "sf"         "data.frame"

Created on 2024-01-30 with reprex v2.1.0

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

No branches or pull requests

1 participant