我可以使用gmaps4rails gem在我的 rails 应用程序中的地图上显示路线,但我无法获得诸如行驶时间和距离等信息以在任何地方显示。
wiki谈到了显示一个面板,但我也没有让它工作。
<div id="instructions"></div>
<%= gmaps("map_options" => {
"zoom" => 14,
"auto_adjust" => false,
"center_latitude" => @location.latitude,
"center_longitude" => @location.longitude
},
"markers" => { "data" => @json },
"direction" => {
"data" => {
"from" => @location.address,
"to" => "Cleveland, OH"
},
"travelMode" => "DRIVING",
"display_panel" => true,
"panel_id" => "instructions"
}) %>