I would like to point on the map were tied to the nearest road and draw lines between them. Following the example of this: polyline snap to road using google maps api v3
The application uses a gem gmaps4rails
<div class="map_container" style='width: 800px; height: 500px;'>
  <div id="map" style='width: 800px; height: 500px;'></div>
</div>  
<script type="text/javascript">
    jQuery(document).ready(function() {
      handler = Gmaps.build('Google', { markers: { maxRandomDistance: null } });
      handler.buildMap({ provider: {}, internal: {id: 'map'}}, function(){
        markers = handler.addMarkers(<%=raw @markers.to_json %>);
        polyline = handler.addPolylines(<%=raw @polyline.to_json %>, { "strokeColor" : "#0088cc" });
        handler.bounds.extendWith(markers);
        handler.fitMapToBounds();
      });
    });
</script>
At the moment I simply draw a line on a map connecting markers