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_zone_lookup not found #144

Open
Karine-Pigeon opened this issue Apr 2, 2024 · 2 comments
Open

utm_zone_lookup not found #144

Karine-Pigeon opened this issue Apr 2, 2024 · 2 comments

Comments

@Karine-Pigeon
Copy link
Member

Karine-Pigeon commented Apr 2, 2024

Error in lookup_epsg_code(zone, datum) :
object 'utm_zone_lookup' not found

Fixed by calling the .csv directly using utm_zone_lookup <- read.csv("https://raw.githubusercontent.com/bcgov/bcmaps/main/data-raw/utm-zone-lookup.csv")

  • seems like the link needs to be updated in the function?

R version 4.3.1.
bcmaps version 2.2.0

#test Data with multiple zones, and a column denoting the zone
df <- data.frame(
animalid = c("a", "b", "c"),
zone = c(10, 11, 11),
easting = c(500000, 800000, 700000),
northing = c(5000000, 3000000, 1000000)
)
utm_convert(df, easting = "easting", northing = "northing", zone = "zone")

@boshek
Copy link
Collaborator

boshek commented Apr 3, 2024

Hey @Karine-Pigeon can you provide some info on how you are generating this error? What function are you calling?

Also what versions of bcdata and R are you using? The output of sessionInfo() would be ideal.

@stephhazlitt
Copy link
Member

Thanks for adding the reprex @Karine-Pigeon. I cannot seem to reproduce the error with bcmaps::utm_convert()—can you confirm this code errors for you in a fresh session?

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}.

df <- data.frame(
  animalid = c("a", "b", "c"),
  zone = c(10, 11, 11),
  easting = c(500000, 800000, 700000),
  northing = c(5000000, 3000000, 1000000)
)

utm_convert(df, easting = "easting", northing = "northing", zone = "zone")
#> Simple feature collection with 3 features and 6 fields
#> Geometry type: POINT
#> Dimension:     XY
#> Bounding box:  xmin: 1237767 ymin: -3576605 xmax: 2418043 ymax: 21953.96
#> Projected CRS: NAD83 / BC Albers
#>      animalid zone       X           Y easting northing
#> 10          a   10 1237767    21953.96   5e+05    5e+06
#> 11.2        b   11 2275642 -1807950.91   8e+05    3e+06
#> 11.3        c   11 2418043 -3576604.70   7e+05    1e+06
#>                      geometry
#> 10   POINT (1237767 21953.96)
#> 11.2 POINT (2275642 -1807951)
#> 11.3 POINT (2418043 -3576605)

session_info()
─ Session info ─────────────────────────────────────────────────
setting value
version R version 4.3.3 (2024-02-29)
os macOS Sonoma 14.3.1
system aarch64, darwin20
ui RStudio
language (EN)
collate en_US.UTF-8
ctype en_US.UTF-8
tz America/Vancouver
date 2024-04-04
rstudio 2023.12.1+402 Ocean Storm (desktop)
pandoc 3.1.1 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/ (via rmarkdown)

─ Packages ─────────────────────────────────────────────────────
package * version date (UTC) lib source
bcmaps * 2.2.0 2024-01-24 [1] CRAN (R 4.3.1)

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

3 participants