Re: [OSRM-talk] (no subject)
Thanks Daniel. It's just for routing costs. On Tue, Aug 29, 2017 at 4:55 PM, Daniel Pattersonwrote: > Hi Jason, > > Depends on what you want to achieve. Travel modes are used for a couple > of things: > > 1) For car routing, we primarily use two modes - normal, and ferry > mode. This affects how the routing costs are calculated. > 2) For the bike profile, the modes end up in the instructions - > sometimes we suggest that you walk your bike. > > Do you need to actually announce mode changes to the user, or do you > just need to identify different modes in order to calculate routing costs? > > daniel > > On Tue, Aug 29, 2017 at 1:50 PM, Jason Dalton > wrote: > >> Hi, >> >> I’m working on a custom routing app and need to apply some custom routing >> rules in OSRM. Is there a mechanism to add a mode of travel? or would I >> need to ‘reuse’ one of the existing modes? For instance, if I wanted to >> create routing rules for ATVs, could I create an “ATV" mode of travel in >> OSRM or would I need to use the normal vehicle routing and modify the >> source data on my own instance? >> >> Thanks, >> Jason >> >> >> >> ___ >> OSRM-talk mailing list >> OSRM-talk@openstreetmap.org >> https://lists.openstreetmap.org/listinfo/osrm-talk >> >> > > ___ > OSRM-talk mailing list > OSRM-talk@openstreetmap.org > https://lists.openstreetmap.org/listinfo/osrm-talk > > -- *Jason Dalton* President, CEO Azimuth1, LLC www.azimuth1.com www.smartdata-solutions.com ___ OSRM-talk mailing list OSRM-talk@openstreetmap.org https://lists.openstreetmap.org/listinfo/osrm-talk
Re: [OSRM-talk] (no subject)
Hey Jason, our routing is fully customizable using profile written in Lua. For an example see here: https://github.com/Project-OSRM/osrm-backend/blob/master/profiles/car.lua You should be able to base your custom profile on the ones that already ship with OSRM. Cheers, Patrick On Tue, Aug 29, 2017 at 8:50 PM, Jason Daltonwrote: > Hi, > > I’m working on a custom routing app and need to apply some custom routing > rules in OSRM. Is there a mechanism to add a mode of travel? or would I > need to ‘reuse’ one of the existing modes? For instance, if I wanted to > create routing rules for ATVs, could I create an “ATV" mode of travel in > OSRM or would I need to use the normal vehicle routing and modify the > source data on my own instance? > > Thanks, > Jason > > > > ___ > OSRM-talk mailing list > OSRM-talk@openstreetmap.org > https://lists.openstreetmap.org/listinfo/osrm-talk > > ___ OSRM-talk mailing list OSRM-talk@openstreetmap.org https://lists.openstreetmap.org/listinfo/osrm-talk
Re: [OSRM-talk] (no subject)
Hi Jason, Depends on what you want to achieve. Travel modes are used for a couple of things: 1) For car routing, we primarily use two modes - normal, and ferry mode. This affects how the routing costs are calculated. 2) For the bike profile, the modes end up in the instructions - sometimes we suggest that you walk your bike. Do you need to actually announce mode changes to the user, or do you just need to identify different modes in order to calculate routing costs? daniel On Tue, Aug 29, 2017 at 1:50 PM, Jason Daltonwrote: > Hi, > > I’m working on a custom routing app and need to apply some custom routing > rules in OSRM. Is there a mechanism to add a mode of travel? or would I > need to ‘reuse’ one of the existing modes? For instance, if I wanted to > create routing rules for ATVs, could I create an “ATV" mode of travel in > OSRM or would I need to use the normal vehicle routing and modify the > source data on my own instance? > > Thanks, > Jason > > > > ___ > OSRM-talk mailing list > OSRM-talk@openstreetmap.org > https://lists.openstreetmap.org/listinfo/osrm-talk > > ___ OSRM-talk mailing list OSRM-talk@openstreetmap.org https://lists.openstreetmap.org/listinfo/osrm-talk
[OSRM-talk] (no subject)
Hi, I’m working on a custom routing app and need to apply some custom routing rules in OSRM. Is there a mechanism to add a mode of travel? or would I need to ‘reuse’ one of the existing modes? For instance, if I wanted to create routing rules for ATVs, could I create an “ATV" mode of travel in OSRM or would I need to use the normal vehicle routing and modify the source data on my own instance? Thanks, Jason ___ OSRM-talk mailing list OSRM-talk@openstreetmap.org https://lists.openstreetmap.org/listinfo/osrm-talk
Re: [OSRM-talk] (no subject)
Hey Romain, Leaflet-Routing-Machine is a good reference for seeing how to query the OSRM route with javascript from a browser: https://github.com/perliedman/leaflet-routing-machine/blob/master/src/L.Routing.OSRM.js They use corslite [1] to do the json querry. [1] https://github.com/perliedman/leaflet-routing-machine/blob/master/src/L.Routing.OSRM.js#L55 Good luck, Patrick On Thu, Feb 12, 2015 at 10:46 AM, Romain NKONGO romain.rn...@gmail.com wrote: Hello to all the OSRM community. I'm a french student who works on a university project, along with my supervisor and uses the open source project OSRM to achieve it. At some point, I have to run some tests (like thousands of tests) to extract some values from the JSON outputs (e.g. the total time). Now our problem is we tried several ways to do this, by sending HTTP GET requests to the running server and treat the returned response as JSON. But we tried with Javascript, jQuery and AngularJS, with functions like $resource.get, jQuery.getJSON $http.get or $http.jsonp and we never managed to get the returned response in a way that we could use it for further treatment in our script. Actually, we were able to send the requests to the server but the response is returned in the fom of an URL link which contains the JSON output in its body, not in the form of a variable in our Javascript that we could manipulate. As a matter of fact, we have two issues for this : - some of the functions we used (which are based on jsonp) added a callback parameter to the sent URL, so the request became invalid with 'Query malformed at the position' errors - I've seen in the OSRM documentation that the JSON output is encoded with the Google polyline algorithm so it could be an invalid JSON for Javascript (we also observed errors like SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data We essentially want to use the viaroute service, so our URL is something like that : htttp://localhost:5000/viaroute?loc=a,bloc=c,d with a,b, c and d random float numbers. Has anyone ever tried to run some customized tests on OSRM, with any Web language, and if so can he give me some tricks of how he succeeded to get the JSON ouptut where he wanted? To be clearer of how I proceeded in AngularJS, here the code of my app.js : var app = angular.module('clientOSRM', ['ngResource']); app.controller('appController', ['$scope','$http', 'appServices', function ($scope,$http, appServices) { //Initialisation de notre input, sa valeur sera stockée en instantané dans cette variable (ng-model) $scope.valueInput1 = 47.3654647,0.6822917; $scope.valueInput2 = 47.3905003,0.6920979; var getItineraryParams = function () { return { start: $scope.valueInput1, end: $scope.valueInput2 //start: 47.3654647,0.6822917, //end: 47.3905003,0.6920979 //start: a,b, //end: c,d } }; //Une fonction accessible que dans ce controleur (mot clé var) var getItinerary = function () { appServices.osrm.get(getItineraryParams(), function (itinerary) { alert(Succes : +typeof itinerary); console.log(itinerary); }, function (error) { alert(erreur : +typeof error+; status : +error.status); console.log(error); } ); /*$http.jsonp( http://localhost:5000/viaroute?loc=47.3654647,0.6822917loc=47.3905003,0.6920979alt=falsegeometry=falseoutput=json ) .success(function(data, status, headers, config) { console.log(data); }). error(function(data, status, headers, config) { console.log(data); });*/ }; //Une fonction accessible depuis la vue //Fonction appelée à l'envoi du formulaire (balise ng-submit dans form) $scope.submit = function () { //On peut récupérer la valeur de notre input ! //console.log($scope.valueInput1); getItinerary(); }; }]); app.run(function ($rootScope) { $rootScope.safeApply = function (fn) { var phase = $rootScope.$$phase; if (phase === '$apply' || phase === '$digest') { if (fn (typeof(fn) === 'function')) { fn(); } } else { this.$apply(fn); } }; }); and also the appServices.js code : app.factory('appServices', function ($resource) { return { osrm: $resource(, {}, { 'get': { method: 'GET', params: {start: '@start', end: '@end'}, isArray:true, url: http://localhost:5000/viaroute?loc=:startloc=:endalt=falsegeometry=false } }) }; }); In the getItinerary function in app.js, the error function (the 3rd parameter) is always triggered even with a HTTP status code '200 OK' of the request.
Re: [OSRM-talk] (no subject)
Hey Patrick, Thanks for the help. Sorry but I'm a little bit new with Javascript environment. I see that the first link you sent me is contained in a full-working project. In order to use the functionalities of the .js file, do I have to include the whole project in some way, or can I re-use the single file on my side without any extra-dependencies? Also, is the leaflet routing machine is useful to run many tests on the OSRM server with random locations values each time? Romain. 2015-02-12 11:34 GMT+01:00 Patrick Niklaus patrick.nikl...@student.kit.edu : Hey Romain, Leaflet-Routing-Machine is a good reference for seeing how to query the OSRM route with javascript from a browser: https://github.com/perliedman/leaflet-routing-machine/blob/master/src/L.Routing.OSRM.js They use corslite [1] to do the json querry. [1] https://github.com/perliedman/leaflet-routing-machine/blob/master/src/L.Routing.OSRM.js#L55 Good luck, Patrick On Thu, Feb 12, 2015 at 10:46 AM, Romain NKONGO romain.rn...@gmail.com wrote: Hello to all the OSRM community. I'm a french student who works on a university project, along with my supervisor and uses the open source project OSRM to achieve it. At some point, I have to run some tests (like thousands of tests) to extract some values from the JSON outputs (e.g. the total time). Now our problem is we tried several ways to do this, by sending HTTP GET requests to the running server and treat the returned response as JSON. But we tried with Javascript, jQuery and AngularJS, with functions like $resource.get, jQuery.getJSON $http.get or $http.jsonp and we never managed to get the returned response in a way that we could use it for further treatment in our script. Actually, we were able to send the requests to the server but the response is returned in the fom of an URL link which contains the JSON output in its body, not in the form of a variable in our Javascript that we could manipulate. As a matter of fact, we have two issues for this : - some of the functions we used (which are based on jsonp) added a callback parameter to the sent URL, so the request became invalid with 'Query malformed at the position' errors - I've seen in the OSRM documentation that the JSON output is encoded with the Google polyline algorithm so it could be an invalid JSON for Javascript (we also observed errors like SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data We essentially want to use the viaroute service, so our URL is something like that : htttp://localhost:5000/viaroute?loc=a,bloc=c,d with a,b, c and d random float numbers. Has anyone ever tried to run some customized tests on OSRM, with any Web language, and if so can he give me some tricks of how he succeeded to get the JSON ouptut where he wanted? To be clearer of how I proceeded in AngularJS, here the code of my app.js : var app = angular.module('clientOSRM', ['ngResource']); app.controller('appController', ['$scope','$http', 'appServices', function ($scope,$http, appServices) { //Initialisation de notre input, sa valeur sera stockée en instantané dans cette variable (ng-model) $scope.valueInput1 = 47.3654647,0.6822917; $scope.valueInput2 = 47.3905003,0.6920979; var getItineraryParams = function () { return { start: $scope.valueInput1, end: $scope.valueInput2 //start: 47.3654647,0.6822917, //end: 47.3905003,0.6920979 //start: a,b, //end: c,d } }; //Une fonction accessible que dans ce controleur (mot clé var) var getItinerary = function () { appServices.osrm.get(getItineraryParams(), function (itinerary) { alert(Succes : +typeof itinerary); console.log(itinerary); }, function (error) { alert(erreur : +typeof error+; status : +error.status); console.log(error); } ); /*$http.jsonp( http://localhost:5000/viaroute?loc=47.3654647,0.6822917loc=47.3905003,0.6920979alt=falsegeometry=falseoutput=json ) .success(function(data, status, headers, config) { console.log(data); }). error(function(data, status, headers, config) { console.log(data); });*/ }; //Une fonction accessible depuis la vue //Fonction appelée à l'envoi du formulaire (balise ng-submit dans form) $scope.submit = function () { //On peut récupérer la valeur de notre input ! //console.log($scope.valueInput1); getItinerary(); }; }]); app.run(function ($rootScope) { $rootScope.safeApply = function (fn) { var phase = $rootScope.$$phase; if (phase === '$apply' || phase === '$digest') { if (fn (typeof(fn) === 'function')) { fn(); } } else { this.$apply(fn); } };
Re: [OSRM-talk] (no subject)
Hi, If you want raw json data, then use a normal query like $http.get. Second, you can pass compression=false to bypass the polyline encoding. Cheers, Guillaume ___ OSRM-talk mailing list OSRM-talk@openstreetmap.org https://lists.openstreetmap.org/listinfo/osrm-talk
[OSRM-talk] (no subject)
Hello to all the OSRM community. I'm a french student who works on a university project, along with my supervisor and uses the open source project OSRM to achieve it. At some point, I have to run some tests (like thousands of tests) to extract some values from the JSON outputs (e.g. the total time). Now our problem is we tried several ways to do this, by sending HTTP GET requests to the running server and treat the returned response as JSON. But we tried with Javascript, jQuery and AngularJS, with functions like $resource.get, jQuery.getJSON $http.get or $http.jsonp and we never managed to get the returned response in a way that we could use it for further treatment in our script. Actually, we were able to send the requests to the server but the response is returned in the fom of an URL link which contains the JSON output in its body, not in the form of a variable in our Javascript that we could manipulate. As a matter of fact, we have two issues for this : - some of the functions we used (which are based on jsonp) added a callback parameter to the sent URL, so the request became invalid with 'Query malformed at the position' errors - I've seen in the OSRM documentation that the JSON output is encoded with the Google polyline algorithm so it could be an invalid JSON for Javascript (we also observed errors like SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data We essentially want to use the viaroute service, so our URL is something like that : htttp://localhost:5000/viaroute?loc=a,bloc=c,d with a,b, c and d random float numbers. Has anyone ever tried to run some customized tests on OSRM, with any Web language, and if so can he give me some tricks of how he succeeded to get the JSON ouptut where he wanted? To be clearer of how I proceeded in AngularJS, here the code of my app.js : var app = angular.module('clientOSRM', ['ngResource']); app.controller('appController', ['$scope','$http', 'appServices', function ($scope,$http, appServices) { //Initialisation de notre input, sa valeur sera stockée en instantané dans cette variable (ng-model) $scope.valueInput1 = 47.3654647,0.6822917; $scope.valueInput2 = 47.3905003,0.6920979; var getItineraryParams = function () { return { start: $scope.valueInput1, end: $scope.valueInput2 //start: 47.3654647,0.6822917, //end: 47.3905003,0.6920979 //start: a,b, //end: c,d } }; //Une fonction accessible que dans ce controleur (mot clé var) var getItinerary = function () { appServices.osrm.get(getItineraryParams(), function (itinerary) { alert(Succes : +typeof itinerary); console.log(itinerary); }, function (error) { alert(erreur : +typeof error+; status : +error.status); console.log(error); } ); /*$http.jsonp( http://localhost:5000/viaroute?loc=47.3654647,0.6822917loc=47.3905003,0.6920979alt=falsegeometry=falseoutput=json ) .success(function(data, status, headers, config) { console.log(data); }). error(function(data, status, headers, config) { console.log(data); });*/ }; //Une fonction accessible depuis la vue //Fonction appelée à l'envoi du formulaire (balise ng-submit dans form) $scope.submit = function () { //On peut récupérer la valeur de notre input ! //console.log($scope.valueInput1); getItinerary(); }; }]); app.run(function ($rootScope) { $rootScope.safeApply = function (fn) { var phase = $rootScope.$$phase; if (phase === '$apply' || phase === '$digest') { if (fn (typeof(fn) === 'function')) { fn(); } } else { this.$apply(fn); } }; }); and also the appServices.js code : app.factory('appServices', function ($resource) { return { osrm: $resource(, {}, { 'get': { method: 'GET', params: {start: '@start', end: '@end'}, isArray:true, url: http://localhost:5000/viaroute?loc=:startloc=:endalt=falsegeometry=false; } }) }; }); In the getItinerary function in app.js, the error function (the 3rd parameter) is always triggered even with a HTTP status code '200 OK' of the request. Any ideas where it could go wrong? Thanks in advance. ___ OSRM-talk mailing list OSRM-talk@openstreetmap.org https://lists.openstreetmap.org/listinfo/osrm-talk
Re: [OSRM-talk] (no subject)
Thanks to all for your suggestions. To Guillaume : I searched about the $http.get function and I wrote this function to test if all goes well (I think I've tried it before) : var getItinerary2=function(){ $http.get( http://localhost:5000/viaroute?loc=47.3654647,0.6822917loc=47.3905003,0.6920979compression=false .success(function(data, status, headers, config) { console.log(data); }). error(function(data, status, headers, config) { console.log(error); }); }; Then I call it when I press Submit but the error function is triggered (the browser console prints error). Am I doing something wrong? To Patrick : I will take a look at the JS file to find what could be helpful. But, to be clear, what I'm trying to do is send a query to the OSRM server and get back the response in the backend, in my script, not directly in frontend, as I want to extract some information from the output. To Emil : I saw the Cucumber Suite in the OSRM project but those are precomputed tests, with known responses to the requests. In my case, I will run tests on a large map (OSM file size : 122 Mo) with random locations pairs inside the area. 2015-02-12 13:47 GMT+01:00 Emil Tin e...@tin.dk: The OSRM project includes a set of cucumber tests that does a lot of testing of binaries, including preparing data and querying the server. It’s ruby based but maybe it can help you. Look in the folder features/. The various support files that queries osrm are in features/support/ See https://github.com/Project-OSRM/osrm-backend/wiki/Cucumber-Test-Suite for more. Emil On 12 Feb 2015, at 10:46 , Romain NKONGO romain.rn...@gmail.com wrote: Hello to all the OSRM community. I'm a french student who works on a university project, along with my supervisor and uses the open source project OSRM to achieve it. At some point, I have to run some tests (like thousands of tests) to extract some values from the JSON outputs (e.g. the total time). Now our problem is we tried several ways to do this, by sending HTTP GET requests to the running server and treat the returned response as JSON. But we tried with Javascript, jQuery and AngularJS, with functions like $resource.get, jQuery.getJSON $http.get or $http.jsonp and we never managed to get the returned response in a way that we could use it for further treatment in our script. Actually, we were able to send the requests to the server but the response is returned in the fom of an URL link which contains the JSON output in its body, not in the form of a variable in our Javascript that we could manipulate. As a matter of fact, we have two issues for this : - some of the functions we used (which are based on jsonp) added a callback parameter to the sent URL, so the request became invalid with 'Query malformed at the position' errors - I've seen in the OSRM documentation that the JSON output is encoded with the Google polyline algorithm so it could be an invalid JSON for Javascript (we also observed errors like SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data We essentially want to use the viaroute service, so our URL is something like that : htttp://localhost:5000/viaroute?loc=a,bloc=c,d with a,b, c and d random float numbers. Has anyone ever tried to run some customized tests on OSRM, with any Web language, and if so can he give me some tricks of how he succeeded to get the JSON ouptut where he wanted? To be clearer of how I proceeded in AngularJS, here the code of my app.js : var app = angular.module('clientOSRM', ['ngResource']); app.controller('appController', ['$scope','$http', 'appServices', function ($scope,$http, appServices) { //Initialisation de notre input, sa valeur sera stockée en instantané dans cette variable (ng-model) $scope.valueInput1 = 47.3654647,0.6822917; $scope.valueInput2 = 47.3905003,0.6920979; var getItineraryParams = function () { return { start: $scope.valueInput1, end: $scope.valueInput2 //start: 47.3654647,0.6822917, //end: 47.3905003,0.6920979 //start: a,b, //end: c,d } }; //Une fonction accessible que dans ce controleur (mot clé var) var getItinerary = function () { appServices.osrm.get(getItineraryParams(), function (itinerary) { alert(Succes : +typeof itinerary); console.log(itinerary); }, function (error) { alert(erreur : +typeof error+; status : +error.status); console.log(error); } ); /*$http.jsonp( http://localhost:5000/viaroute?loc=47.3654647,0.6822917loc=47.3905003,0.6920979alt=falsegeometry=falseoutput=json ) .success(function(data, status, headers, config) { console.log(data); }). error(function(data, status, headers, config) {
Re: [OSRM-talk] (no subject)
Ok, so after reading the Leaflet file, it seems to be an appropriate way to send a HTTP request to the server and get the response back as variables I could process in my script. Now I wonder how I could take this interesting piece of code and adapt it to my AngularJS implementation. 2015-02-12 15:00 GMT+01:00 Romain NKONGO romain.rn...@gmail.com: Thanks to all for your suggestions. To Guillaume : I searched about the $http.get function and I wrote this function to test if all goes well (I think I've tried it before) : var getItinerary2=function(){ $http.get( http://localhost:5000/viaroute?loc=47.3654647,0.6822917loc=47.3905003,0.6920979compression=false .success(function(data, status, headers, config) { console.log(data); }). error(function(data, status, headers, config) { console.log(error); }); }; Then I call it when I press Submit but the error function is triggered (the browser console prints error). Am I doing something wrong? To Patrick : I will take a look at the JS file to find what could be helpful. But, to be clear, what I'm trying to do is send a query to the OSRM server and get back the response in the backend, in my script, not directly in frontend, as I want to extract some information from the output. To Emil : I saw the Cucumber Suite in the OSRM project but those are precomputed tests, with known responses to the requests. In my case, I will run tests on a large map (OSM file size : 122 Mo) with random locations pairs inside the area. 2015-02-12 13:47 GMT+01:00 Emil Tin e...@tin.dk: The OSRM project includes a set of cucumber tests that does a lot of testing of binaries, including preparing data and querying the server. It’s ruby based but maybe it can help you. Look in the folder features/. The various support files that queries osrm are in features/support/ See https://github.com/Project-OSRM/osrm-backend/wiki/Cucumber-Test-Suite for more. Emil On 12 Feb 2015, at 10:46 , Romain NKONGO romain.rn...@gmail.com wrote: Hello to all the OSRM community. I'm a french student who works on a university project, along with my supervisor and uses the open source project OSRM to achieve it. At some point, I have to run some tests (like thousands of tests) to extract some values from the JSON outputs (e.g. the total time). Now our problem is we tried several ways to do this, by sending HTTP GET requests to the running server and treat the returned response as JSON. But we tried with Javascript, jQuery and AngularJS, with functions like $resource.get, jQuery.getJSON $http.get or $http.jsonp and we never managed to get the returned response in a way that we could use it for further treatment in our script. Actually, we were able to send the requests to the server but the response is returned in the fom of an URL link which contains the JSON output in its body, not in the form of a variable in our Javascript that we could manipulate. As a matter of fact, we have two issues for this : - some of the functions we used (which are based on jsonp) added a callback parameter to the sent URL, so the request became invalid with 'Query malformed at the position' errors - I've seen in the OSRM documentation that the JSON output is encoded with the Google polyline algorithm so it could be an invalid JSON for Javascript (we also observed errors like SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data We essentially want to use the viaroute service, so our URL is something like that : htttp://localhost:5000/viaroute?loc=a,bloc=c,d with a,b, c and d random float numbers. Has anyone ever tried to run some customized tests on OSRM, with any Web language, and if so can he give me some tricks of how he succeeded to get the JSON ouptut where he wanted? To be clearer of how I proceeded in AngularJS, here the code of my app.js : var app = angular.module('clientOSRM', ['ngResource']); app.controller('appController', ['$scope','$http', 'appServices', function ($scope,$http, appServices) { //Initialisation de notre input, sa valeur sera stockée en instantané dans cette variable (ng-model) $scope.valueInput1 = 47.3654647,0.6822917; $scope.valueInput2 = 47.3905003,0.6920979; var getItineraryParams = function () { return { start: $scope.valueInput1, end: $scope.valueInput2 //start: 47.3654647,0.6822917, //end: 47.3905003,0.6920979 //start: a,b, //end: c,d } }; //Une fonction accessible que dans ce controleur (mot clé var) var getItinerary = function () { appServices.osrm.get(getItineraryParams(), function (itinerary) { alert(Succes : +typeof itinerary); console.log(itinerary); }, function (error) { alert(erreur : +typeof error+;