-
Notifications
You must be signed in to change notification settings - Fork 383
Polylines
apneadiving edited this page Sep 15, 2011
·
6 revisions
Valid json should be like:
[
//first element of the array, describing the first polyline
[
//first element of the polyline can optionally contain customization
{"lng": -80.190262, "lat": 25.774252, "strokeColor": "#000"},
//other hashes simply contain longitude and lat
{"lng": -66.118292, "lat": 18.466465},
{"lng": -64.75737, "lat": 32.321384}
],
//second polyline
[
//no customization in the first hash => all defaults will be applied to display this polyline
{"lng": 0, "lat": 0},
{"lng": 10, "lat": 10},
{"lng": -10, "lat": -10}
]
]
strokeColor: "#FF0000",
strokeOpacity: 1,
strokeWeight: 2,
<%= gmaps({
"polylines" => { "data" => @polylines_json }
})
%>
Simply pass options you want to override in a hash.
<%= gmaps({
"polylines" => { "data" => @polylines , "options" => { "strokeColor" => "#000" } }
})
%>
<% @traj = User.destination({"from" => "Nice", "to" => "Paris"}, {"language" => "fr", "waypoints" => ["Toulon","Toulouse", "Lorient", "Bourges", "Strasbourg", "Namur"] }, "pretty") %>
<% @traj.each do |traj| %>
<%= raw traj["polylines"] + "," %>
<% end %>