I have a below function which displays a map. but how to set the loop in .addPolylines() function. I get proper latitude & longitude but I added a loop but it has displayed a blank map. can you help me to fix it?
create_map(<%= raw @boundary_points.to_json %>);
function create_map(boundary_points){
var handler = Gmaps.build('Google');
handler.buildMap({ internal: {id: 'geolocation'}}, function(){
for (i = 1; i < boundary_points.length; i++) {
var ls = boundary_points[i].trim().split(" ");
}
var polylines = handler.addPolylines(
[
[
for (i = 1; i < boundary_points.length; i++) {
var ls = boundary_points[i].trim().split(" ");
{lat: ls[0], lng: ls[1]},
}
]
],
{ strokeColor: '#FF0000'}
);
handler.bounds.extendWith(polylines);
handler.fitMapToBounds();
handler.getMap().setZoom(15);
alert(boundary_points);
I have a below function which displays a map. but how to set the loop in .addPolylines() function. I get proper latitude & longitude but I added a loop but it has displayed a blank map. can you help me to fix it?
create_map(<%= raw @boundary_points.to_json %>);
function create_map(boundary_points){ var handler = Gmaps.build('Google');
}); }