Coder Social home page Coder Social logo

Comments (4)

rCarto avatar rCarto commented on July 21, 2024

Hello,
There is no particular configuration to apply on the OSRM server to make it work with the package.
But it is true that it is difficult to troubleshot this issue without knowing more about the server config.
Have you tried to use a simpler example ? Something like :

library(osrm)
options(
  osrm.server = "http://server_adress with port (maybe?)/", 
  osrm.profile = "driving_or_car"
)
osrmTable(
  src = data.frame(x = 13.39, y = 52.52), 
  dst = data.frame(x = 13.385, y = 52.515)
)
osrmRoute(
  src = data.frame(x = 13.39, y = 52.52), 
  dst = data.frame(x = 13.385, y = 52.515)
)

Does any of this work?

(You can send me the actual server address by mail if you want me to test it directly (my e-mail address is in the DESCRIPTION file of the package))

from osrm.

fjeuland avatar fjeuland commented on July 21, 2024

@rCarto , you kindly suggests to slice the data.

I encountered now a new error :

> src <- st_centroid(COM)
> dst <- src
> dist1 <- osrmTable(src = src[1:10,c("lon", "lat")], 
+                    dst = dst[, c("lon", "lat")])
Error in `[.data.frame`(x, i, j, drop = drop) : 
  colonnes non définies sélectionnées

This should come from my original COM has a geometry column instead of lon & lat; I thus changed the code to :

> dist1 <- osrmTable(src = src[1:10,c("geometry")], 
+                    dst = dst[, c("geometry)])
+ 

but the prompt seemed to wait for an other parameter (as the calculus doesn't start) or so ?

NB : just in case, this one is ok :

> distA3 <- osrmTable(loc = src[1:100,])

from osrm.

rCarto avatar rCarto commented on July 21, 2024

You simply have a missing double quote (").

dist1 <- osrmTable(src = src[1:10,c("geometry")], 
                              dst = dst[, c("geometry")])

+ it would be a better practice to use st_geometry() instead of accessing the geom column name ("geometry"). Moreover this operation is not even needed as osrmTable() accepts sf object. This should work:

dist1 <- osrmTable(src = src[1:10, ], dst = dst)

from osrm.

rCarto avatar rCarto commented on July 21, 2024

For the record the initial problem seems to be related to the config of OSRM server deployment (see Project-OSRM/osrm-backend#1875).
A solution that does not imply modifying the server config would be to slice the osrmTable() calls, see the (over)simplified example here.

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.