Giter VIP home page Giter VIP logo

Comments (6)

rCarto avatar rCarto commented on June 14, 2024

There is a small bug.
A quick workaround is to return an sf object

library(osrm)
library(sf)
test <- osrmIsochrone(loc = c(-2.4529553,52.71386), 
                      breaks = seq(from = 0,to=8,by=8), 
                      returnclass = "sf")
st_geometry(test) <- st_collection_extract(x = st_geometry(test), 
                                           type = "POLYGON")
test <- as(test, "Spatial")

from osrm.

rCarto avatar rCarto commented on June 14, 2024

The bug is fixed in the dev version of the package:
remotes::install_github("rCarto/osrm")

from osrm.

jiaweniscute avatar jiaweniscute commented on June 14, 2024

Hi There!

The manual workaround works!

However, the update doesnt seem to fix the error in

test <- osrmIsochrone(loc = c(-2.4529553,52.71386), 
                      breaks = seq(from = 0,to=8,by=8)

Ran remotes::install_github("rCarto/osrm") to get the updates but received the same error on the same set of coordinates.

Error in .as_Spatial(from, cast, IDs) : 
  conversion from feature type sfc_GEOMETRY to sp is not supported

Not sure if I missed anything!

from osrm.

rCarto avatar rCarto commented on June 14, 2024

Mmmm, what is your sessionInfo() after loading sf and osrm?

from osrm.

jiaweniscute avatar jiaweniscute commented on June 14, 2024

Oops, I am not sure why but it suddenly works today.

Perhaps I needed to restart my R session.

Here is my sessionInfo() anyway! - Thank you so much for your quick response!

R version 3.5.2 (2018-12-20)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.4

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/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] sf_0.7-3        raster_2.8-19   sp_1.3-1        osrm_3.3.0.9000 htmltools_0.3.6 mapview_2.6.3  
 [7] plotly_4.9.0    gplots_3.0.1.1  lattice_0.20-38 reshape_0.8.8   leaflet_2.0.2   lubridate_1.7.4
[13] forcats_0.4.0   stringr_1.4.0   dplyr_0.8.0.1   purrr_0.3.2     readr_1.3.1     tidyr_0.8.3    
[19] tibble_2.1.1    ggplot2_3.1.1   tidyverse_1.2.1

loaded via a namespace (and not attached):
 [1] httr_1.4.0         jsonlite_1.6       viridisLite_0.3.0  modelr_0.1.4       gtools_3.8.1      
 [6] shiny_1.3.2        assertthat_0.2.1   stats4_3.5.2       cellranger_1.1.0   yaml_2.2.0        
[11] pillar_1.3.1       backports_1.1.4    glue_1.3.1         digest_0.6.18      promises_1.0.1    
[16] rvest_0.3.3        colorspace_1.4-1   httpuv_1.5.1       plyr_1.8.4         pkgconfig_2.0.2   
[21] broom_0.5.2        haven_2.1.0        xtable_1.8-4       webshot_0.5.1      scales_1.0.0      
[26] gdata_2.18.0       satellite_1.0.1    later_0.8.0        generics_0.0.2     withr_2.1.2       
[31] lazyeval_0.2.2     cli_1.1.0          magrittr_1.5       crayon_1.3.4       readxl_1.3.1      
[36] mime_0.6           nlme_3.1-139       lwgeom_0.1-6       xml2_1.2.0         class_7.3-15      
[41] tools_3.5.2        data.table_1.12.2  hms_0.4.2          munsell_0.5.0      isoband_0.2.0     
[46] compiler_3.5.2     e1071_1.7-1        caTools_1.17.1.2   rlang_0.3.4        RCurl_1.95-4.12   
[51] units_0.6-2        classInt_0.3-1     grid_3.5.2         rstudioapi_0.10    htmlwidgets_1.3   
[56] crosstalk_1.0.0    labeling_0.3       bitops_1.0-6       base64enc_0.1-3    gtable_0.3.0      
[61] codetools_0.2-16   DBI_1.0.0          R6_2.4.0           rgdal_1.4-3        knitr_1.22        
[66] KernSmooth_2.23-15 stringi_1.4.3      Rcpp_1.0.1         png_0.1-7          tidyselect_0.2.5  
[71] xfun_0.6    

from osrm.

rCarto avatar rCarto commented on June 14, 2024

Glad it works!

from osrm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.