Hi guys, I''m trying to use longitude and latitude to center a map like so: <%= gmaps("map_options" => { "auto_zoom" => true, "center_latitude" => 40.7275043, "center_longitude" => -73.9800645},"markers" => { "data" => @json}) %> I have tried several variations of the line above, but none of them seem to center the map where I need it centered. I''m I missing something? If so, please let me know. Thank you much! Bertly -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Are you using a static map? If so, maybe I can help you with my static map setup. I''ve used the googlestaticmap gem for that. - unless RAILS_ENV.eql?("test") - map = GoogleStaticMap.new(:zoom => 11, :center => MapLocation.new(:address => resource.full_address), :width => 150, :height => 150) - map.markers << MapMarker.new(:color => "blue", :location => MapLocation.new(:address => resource.full_address)) - image_address = to_https(map.url) = link_to image_tag(image_address), google_maps_url(resource.full_address), :target => "_blank" if image_address It''s HAML, so - is <%- and = is <% This code only runs on development and production only to prevent it from accessing the internet during test runs. Even though you provide it with an address, it still needs a single marker in order for it to be centered. That''s how I got it centered properly. Try adding a marker to your map object, if possible. -- http://rubyonrailsdeveloper.nl -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Try use gmaps with this map option: "auto_adjust" => false or just with js: pos = new google.maps.LatLng(your_lat, your_lng); Gmaps4Rails.map.setCenter(pos); On Aug 15, 10:53 pm, bertly_the_coder <much...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi guys, > > I''m trying to use longitude and latitude to center a map like so: > <%= gmaps("map_options" => { "auto_zoom" => true, "center_latitude" => > 40.7275043, "center_longitude" => -73.9800645},"markers" => { "data" > => @json}) %> > > I have tried several variations of the line above, but none of them > seem to center the map where I need it centered. I''m I missing > something? If so, please let me know. > > Thank you much! > Bertly-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.