Search code examples
ruby-on-railsstylesgmaps4rails

How to change map style in gmaps4rails


I am working with gmaps4rails and was wondering if there is a way to change map style (feature, color etc) in gmaps4rails. Do i have to use json for that?

thank you,


Solution

  • <%= gmaps( :map_options => {:raw => "{styles: myStyle}" }, 
               :markers     => { "data" => @json, "options" => {"draggable" => true, "list_container" => "markers_list" } }) %>
    
    <script type="text/javascript" charset="utf-8">
    var myStyle = [ 
      { featureType: "all", stylers: [{ "hue": "#ff1a00" } ]} 
    ];
    </script>