-
Notifications
You must be signed in to change notification settings - Fork 382
Polygons
apneadiving edited this page Sep 15, 2011
·
4 revisions
Valid json to provide should be like:
[
//first element of the array, describing the first polygon
[
//first hash here could optionally contain settings for the current polygon (which won't use defaults then)
{
"lng": -80.190262, "lat": 25.774252,
"strokeColor": "#FF0000",
"strokeOpacity": 0.3,
"strokeWeight": 1,
"fillColor": "#FF0000",
"fillOpacity": 0.7
},
//other hashes simply contain longitude and latitude
{"lng": -66.118292, "lat": 18.466465},
{"lng": -64.75737, "lat": 32.321384}
],
//second polygon
[
// the first hash contains no customization so it will use default display options
{"lng": 0, "lat": 0},
{"lng": 10, "lat": 10},
{"lng": -10, "lat": -10}
]
//add as many array as you want
]
strokeColor: "#000",
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: "#000",
fillOpacity: 0.35
<%= gmaps({
"polygons" => { "data" => @polygons_json }
})
%>
Simply pass options you want to override in a hash.
<%= gmaps({
"polygons" => { "data" => @polygons , "options" => { "fillColor" => "#000" } }
})
%>