-
Notifications
You must be signed in to change notification settings - Fork 378
Polylines
apneadiving edited this page Mar 15, 2011
·
6 revisions
Valid json should be like:
[
//first element of the array, describing the first polyline
[
//first hash here could optionally contain settings for the current polyline (which won't use defaults then)
{
"strokeColor": "#FF0000",
"strokeOpacity": 0.3,
"strokeWeight": 1
},
//other hashes simply contain longitude and latitude
{"longitude": -80.190262, "latitude": 25.774252},
{"longitude": -66.118292, "latitude": 18.466465},
{"longitude": -64.75737, "latitude": 32.321384}
],
//second polyline
[
// the first hash contains positions so it will use default display options
{"longitude": 0, "latitude": 0},
{"longitude": 10, "latitude": 10},
{"longitude": -10, "latitude": -10}
]
]
strokeColor: "#FF0000",
strokeOpacity: 1,
strokeWeight: 2,
<%= gmaps({
"polylines" => { "data" => @polylines_json }
})
%>
Simply pass options you want to override in a hash.
<%= gmaps({
"polygons" => { "data" => @polygons , "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 %>