0

I'm using {sf} to import a GeoJSON file. What does the black icon represent? I'm trying to join coordinates to this object via st_join(ken_con_sf, join = st_within) and it seems to fail where coordinates fall within the polygons represented by these icons.

enter image description here

library(sf)
ken_con_sf <- 
    read_sf("https://raw.githubusercontent.com/mikelmaron/kenya-election-data/master/data/constituencies.geojson") %>%
    st_transform(4326)
R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.7

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/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     datasets  methods   base     

other attached packages:
 [1] maps_3.3.0           sp_1.4-2             sf_0.9-6            
 [4] ggrepel_0.8.2        zoo_1.8-8            leaflet_2.0.3       
 [7] showtext_0.9         showtextdb_3.0       sysfonts_0.8.1      
[10] lubridate_1.7.9      shinyWidgets_0.5.3   rmarkdown_2.5       
[13] shiny_1.5.0          flexdashboard_0.5.2  dplyr.teradata_0.3.2
[16] niviR_0.1.0          dbplyr_1.4.4         forcats_0.5.0       
[19] stringr_1.4.0        dplyr_1.0.2          purrr_0.3.4         
[22] readr_1.4.0          tidyr_1.1.2          tibble_3.0.4        
[25] ggplot2_3.3.2        tidyverse_1.3.0      RSQLite_2.2.1       
[28] RPostgres_1.2.0     

loaded via a namespace (and not attached):
 [1] fs_1.5.0           bit64_4.0.5        httr_1.4.2        
 [4] tools_4.0.2        backports_1.1.10   utf8_1.1.4        
 [7] R6_2.5.0           KernSmooth_2.23-17 DBI_1.1.0         
[10] colorspace_1.4-1   withr_2.3.0        tidyselect_1.1.0  
[13] bit_4.0.4          compiler_4.0.2     cli_2.1.0         
[16] rvest_0.3.6        xml2_1.3.2         bookdown_0.21     
[19] scales_1.1.1       classInt_0.4-3     odbc_1.2.3        
[22] digest_0.6.27      pkgconfig_2.0.3    htmltools_0.5.0   
[25] fastmap_1.0.1      htmlwidgets_1.5.1  rlang_0.4.8       
[28] readxl_1.3.1       keyring_1.1.0      rstudioapi_0.11   
[31] generics_0.1.0     jsonlite_1.7.1     crosstalk_1.1.0.1 
[34] magrittr_1.5       Rcpp_1.0.5         munsell_0.5.0     
[37] fansi_0.4.1        lifecycle_0.2.0    stringi_1.5.3     
[40] yaml_2.2.1         grid_4.0.2         blob_1.2.1        
[43] promises_1.1.1     crayon_1.3.4       lattice_0.20-41   
[46] haven_2.3.1        hms_0.5.3          knitr_1.30        
[49] pillar_1.4.6       reprex_0.3.0       glue_1.4.2        
[52] evaluate_0.14      modelr_0.1.8       vctrs_0.3.4       
[55] httpuv_1.5.4       cellranger_1.1.0   gtable_0.3.0      
[58] assertthat_0.2.1   xfun_0.19          mime_0.9          
[61] xtable_1.8-4       broom_0.7.0        e1071_1.7-3       
[64] later_1.1.0.1      rsconnect_0.8.16   class_7.3-17      
[67] memoise_1.1.0      units_0.6-7        ellipsis_0.3.1
2
  • Works for me with RStudio 1.3.1073 and R 4.0.0 and sf 0.9.3. Can't see anything odd in the 8th row of the data which I think is the one with the weird blob in your screenshot. Which rows have those icons? Is it RStudio struggling to display the long nested list of the coordinates in its viewer window? – Spacedman Nov 23 '20 at 15:33
  • Thanks for checking, @Spacedman. Maybe it is a viewing issue only. For me it's rows 8, 12, 14-17, lots. If the geometry is valid I need to investigate another reason the join is failing. – Eric Green Nov 23 '20 at 16:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.