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

Adjust Zoom Gmaps4Rails


I'm using the Gmaps4Rails gem and cannot figure out how to adjust the default zoom settings. In my view I have the following code:

<%= gmaps({
   "map_options" => {"auto_adjust" => false, "auto_zoom" => false, "zoom" => 15 },
   "markers"     => {"data" => @json }
  })
%>

I know this has been asked and answered many times, but maybe I'm just not seeing something...any advice? Am i missing something completely obvious? I apologize for reposting this question.

Thanks, Kevin

EDIT

I failed to properly comment out the default instance of gmaps and it overrode my customized settings. Thanks for all the help @apneadiving!


Solution

  • You're simply missing that seeing the whole map means providing a very small number, not a big one!

    <%= gmaps({
      "map_options" => {"auto_adjust" => false, "zoom" => 0 },
      "markers"     => {"data" => @json }
     })
    %>