Skip to content

Instantly share code, notes, and snippets.

@robertmilner
Created February 8, 2012 16:06
Show Gist options
  • Select an option

  • Save robertmilner/1770744 to your computer and use it in GitHub Desktop.

Select an option

Save robertmilner/1770744 to your computer and use it in GitHub Desktop.
Gmaps4rails - Set Zoom Level
<%# commented out original gmaps4rails code to compare %>
<%#= gmaps4rails(@json) %>
<%= gmaps(
:markers => { :data => @json },
:map_options => { :auto_adjust => true, # :auto_adjust map to center on location
:auto_zoom => false, # :auto_zoom defaults to full zoom in, set to false to utilize :zoom
:zoom => 15 } # :zoom 0 is fully zoomed out (world view), 21 is fully zoomed in (street view)
) %>
@robertmilner
Copy link
Copy Markdown
Author

Replace default gmaps4rails(@JSON) ebr in your view to add the ability to set your zoom level.

Code Academy students, we placed this code in our show.html.erb file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment