How to center map in gmaps4rails?

i want to display a map centered to a specific location. In my controller, I use

@gmapsoptions = {
     "map_options" => {"center_latitude" => 40, 
                       "center_longitude" => 73,
                       "detect_location" => false,
                       "center_on_user" => false,
                       "auto_adjust" => false,
                       "auto_zoom" => false,
                       "zoom" => 8 }
                 }

and in my view i use

<%= gmaps(@gmapsoptions) %>

It renders the map just fine, but it is not centered on the location specified above but on "0/0" aka the dateline. How can I fix this?

Answers


Just checked your repo, you should simply have auto_zoom set to true (or remove it since it's the default value).


Need Your Help

Retrieving value from an object within a Map

java object map

I am writing an interpreter program and I am stuck at the moment with this.

Save a list of objects in django

python django django-views django-orm django-1.5

I am using django 1.5 and i am trying to do something like this :

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.