Bug on `pull_crs()`
dieghernan opened this issue · comments
Due to this check, if data has any NA
then return NA
Lines 86 to 90 in 83dff5b
library(tidyterra)
#>
#> Attaching package: 'tidyterra'
#> The following object is masked from 'package:stats':
#>
#> filter
library(tidyverse)
#> Warning: package 'tidyverse' was built under R version 4.1.3
#> Warning: package 'tibble' was built under R version 4.1.3
#> Warning: package 'tidyr' was built under R version 4.1.3
#> Warning: package 'readr' was built under R version 4.1.3
#> Warning: package 'purrr' was built under R version 4.1.3
#> Warning: package 'dplyr' was built under R version 4.1.3
#> Warning: package 'stringr' was built under R version 4.1.3
#> Warning: package 'forcats' was built under R version 4.1.3
t <- mapSpain::esp_get_ccaa(c("Madrid", "Andalucia")) %>%
select(1)
t
#> Simple feature collection with 2 features and 1 field
#> Geometry type: MULTIPOLYGON
#> Dimension: XY
#> Bounding box: xmin: -7.522943 ymin: 35.93634 xmax: -1.630033 ymax: 41.1658
#> Geodetic CRS: ETRS89
#> codauto geometry
#> 2 01 MULTIPOLYGON (((-4.268895 3...
#> 1 13 MULTIPOLYGON (((-3.067689 4...
pull_crs(t)
#> [1] "GEOGCRS[\"ETRS89\",\n DATUM[\"European Terrestrial Reference System 1989\",\n ELLIPSOID[\"GRS 1980\",6378137,298.257222101,\n LENGTHUNIT[\"metre\",1]]],\n PRIMEM[\"Greenwich\",0,\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n CS[ellipsoidal,2],\n AXIS[\"geodetic latitude (Lat)\",north,\n ORDER[1],\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n AXIS[\"geodetic longitude (Lon)\",east,\n ORDER[2],\n ANGLEUNIT[\"degree\",0.0174532925199433]],\n USAGE[\n SCOPE[\"Spatial referencing.\"],\n AREA[\"Europe - onshore and offshore: Albania; Andorra; Austria; Belgium; Bosnia and Herzegovina; Bulgaria; Croatia; Cyprus; Czechia; Denmark; Estonia; Faroe Islands; Finland; France; Germany; Gibraltar; Greece; Hungary; Ireland; Italy; Kosovo; Latvia; Liechtenstein; Lithuania; Luxembourg; Malta; Moldova; Monaco; Montenegro; Netherlands; North Macedonia; Norway including Svalbard and Jan Mayen; Poland; Portugal; Romania; San Marino; Serbia; Slovakia; Slovenia; Spain; Sweden; Switzerland; United Kingdom (UK) including Channel Islands and Isle of Man; Vatican City State.\"],\n BBOX[32.88,-16.1,84.17,40.18]],\n ID[\"EPSG\",4258]]"
# If the data has NAs
t$test1 <- NA
t
#> Simple feature collection with 2 features and 2 fields
#> Geometry type: MULTIPOLYGON
#> Dimension: XY
#> Bounding box: xmin: -7.522943 ymin: 35.93634 xmax: -1.630033 ymax: 41.1658
#> Geodetic CRS: ETRS89
#> codauto geometry test1
#> 2 01 MULTIPOLYGON (((-4.268895 3... NA
#> 1 13 MULTIPOLYGON (((-3.067689 4... NA
pull_crs(t)
#> [1] NA
Created on 2023-02-01 with reprex v2.0.2