How get car route between two coordinates using ruby? -
i'm developing rails app google maps , car routes.
i have start , finish points car route - 2 coordinates. how can full car route (array of coordinates car through streets)? can using gmaps4rails , geocoder? 
something this:
start_point = [41,2423; 45,323452] end_point   = [42,2423; 42,323452]  full_route = some_method_for_calculate_route( start_point, end_point )  #paint line on map array of points paint_line( full_route )   please help, kindly :)
if want client side, have plunkr here.
it highly inspired google documentation here.
basically way interact google libraries
  var handler = gmaps.build('google');   handler.buildmap({ internal: {id: 'map'}}, function(){      var start_point = [43.2423, 5.323452];     var end_point   = [44.2423, 5.323452];      var directionsservice = new google.maps.directionsservice();     var directionsdisplay = new google.maps.directionsrenderer();      directionsdisplay.setmap(handler.getmap());     var request = {       origin:      new google.maps.latlng(start_point[0], start_point[1]),       destination: new google.maps.latlng(end_point[0], end_point[1]),       travelmode:  google.maps.travelmode.driving     };      directionsservice.route(request, function(response, status) {       if (status === google.maps.directionsstatus.ok) {         directionsdisplay.setdirections(response);       }     });   });      
Comments
Post a Comment