ruby on rails - How show two lines on map using gmaps4rails? -


i'm developing rails app, use google maps , paint car routes.

i use gmaps4rails gem drawling line on map,

so, have plan car ( array of coordinates car route plan ) , report car ( array of coordinates car route drove ).

so, have arrays of coordinates - plan , report, example random points :

@plan   = [ [12.124, 12,34253], [11.124, 12,34253], ... [8.124, 5.344] ] @report = [ [12.224, 12,64253], [10.124, 12,34253], ... [9.124, 6.345] ] 

i know how draw 1 line on map, example view 'plan' line on map:

%div.container   %div.panel.panel-default.col-sm-9     %div.panel-body.row       #map.col-sm-12  :javascript   handler = gmaps.build('google');   handler.buildmap({ provider: {}, internal: {id: 'map'}}, function(){     polyline = #{raw @plan.to_json}      handler.addpolyline(polyline); // , not addpolylines     handler.bounds.extend(polyline[0]);     handler.bounds.extend(polyline[ polyline.length - 1]);     handler.fitmaptobounds();   }); 

but need draw 'plan' line , 'report' line on same map. how can draw 2 lines different colors on same map?

thanks kindly.

there error in code, gmaps4rails expects array of objects providing lat , lng properties. transformation quite easy though.

concerning options, can pass them second argument. source code meant clear.

anyway, here working plunkr data


Comments

Popular posts from this blog

How do you convert a timestamp into a datetime in python with the correct timezone? -

how to display 2 form fields on same line with bootstrap -

c# - how to use buttonedit in devexpress gridcontrol -