Skip to content

st_is_valid() throwing error instead of returning NA #501

Closed
@RoyalTS

Description

If I understand sf::st_is_valid() correctly, it should not be throwing the following error upon finding an invalid geometry, correct?

> sf::st_is_valid(us_sf$geometry, NA_on_exception = TRUE)
Error in CPL_geos_is_valid(x[i], as.logical(NA_on_exception)) : 
  Evaluation error: IllegalArgumentException: Invalid number of points in LinearRing found 3 - must be 0 or >= 4.
In addition: There were 15 warnings (use warnings() to see them)

sessionInfo():

> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.5 LTS

Matrix products: default
BLAS: /software/free/r/R-3.4.0/lib/R/lib/libRblas.so
LAPACK: /software/free/r/R-3.4.0/lib/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C         LC_TIME=C            LC_COLLATE=C         LC_MONETARY=C       
 [6] LC_MESSAGES=C        LC_PAPER=C           LC_NAME=C            LC_ADDRESS=C         LC_TELEPHONE=C      
[11] LC_MEASUREMENT=C     LC_IDENTIFICATION=C 

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

other attached packages:
[1] readr_1.1.1      assertr_2.0.2.2  purrr_0.2.2.2    osmdata_0.0.5.99 sf_0.5-4         dplyr_0.7.1     

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.12         futile.logger_1.4.3  compiler_3.4.0       bindr_0.1            futile.options_1.0.0
 [6] tools_3.4.0          lubridate_1.6.0.9009 jsonlite_1.5         tibble_1.3.3         lattice_0.20-35     
[11] pkgconfig_2.0.1      rlang_0.1.1          DBI_0.7              curl_2.8.1           bindrcpp_0.2        
[16] httr_1.3.1           stringr_1.2.0        xml2_1.1.1           atheylab.utils_0.2.0 hms_0.3             
[21] rprojroot_1.2        grid_3.4.0           glue_1.1.1           here_0.1             R6_2.2.2            
[26] sp_1.2-5             lambda.r_1.1.9       udunits2_0.13        magrittr_1.5         backports_1.1.0     
[31] units_0.4-6          assertthat_0.2.0     rvest_0.3.2          stringi_1.1.5        lazyeval_0.2.0  

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions