bcgov / bcmaps

An R package of map layers for British Columbia
http://bcgov.github.io/bcmaps/
Apache License 2.0
73 stars 17 forks source link

tmap and bcmaps issue #100

Closed hgriesbauer closed 2 years ago

hgriesbauer commented 2 years ago

Hello! I get an error message when I try and run the following code. I can't make any headway on figuring this out. Any suggestions?

bc_bound() %>% tm_shape()+ tm_polygons(col="lightblue")

The error message: Error: Assigned data NA must be compatible with existing data. i Error occurred for column COLOR_1. x Can't convert to .

The code works if I omit the color parameter. I think the issue is with the bc_bound sf object.

hgriesbauer commented 2 years ago

Forgot to say thanks in advance!

stephhazlitt commented 2 years ago

Thanks @hgriesbauer, can you provide your session details with package versions?

stephhazlitt commented 2 years ago
library(bcmaps)
#> Loading required package: sf
#> Linking to GEOS 3.9.1, GDAL 3.2.3, PROJ 7.2.1; sf_use_s2() is TRUE
library(tmap)

bc_bound() |> 
  tm_shape() +
  tm_polygons(col="lightblue")
#> bc_bound_hres was updated on 2021-12-11

Created on 2022-01-25 by the reprex package (v2.0.1)

sessionInfo() R version 4.1.2 (2021-11-01) Platform: aarch64-apple-darwin20 (64-bit) Running under: macOS Big Sur 11.6

Matrix products: default LAPACK: /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/lib/libRlapack.dylib

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages: [1] stats graphics grDevices utils
[5] datasets methods base

other attached packages: [1] tmap_3.3-2 bcmaps_1.0.2 sf_1.0-5

hgriesbauer commented 2 years ago

HI @stephhazlitt thanks for the prompt reply! I updated my tmap and bcmaps packages, and it works now. Thanks again!