Search code examples
ruby-on-railsrubyruby-on-rails-3google-mapsgmaps4rails

How to customize map controls using Gmaps4rails gem?


i've got confused trying to change the map controls like said here But don`t know how to implement using gmaps4rails gem.

I just wanted to leave only zoom and pan control and remove all the others. But js console says for:

 >> Gmaps.map.map.mapTypeControl
 >> false

But it is still present on a map.


Solution

  • You can use a raw parameter to send any map option you need. See doc.

    I guess, you should do:

    <%= gmaps(:map_options => { :raw => '{ panControl: true,
                                           zoomControl: true,
                                           mapTypeControl: false,
                                           scaleControl: false,
                                           streetViewControl: false,
                                           overviewMapControl: false}' 
                              },
              :markers => { :data => @json  } 
    )%>