Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do i fix google maps api v3 from showing up as a gray box?

Tags:

google-maps

when i search for nearby locations on the site i am workign on the results show up in a list but the map area is just grayed out sometimes it comes back but then goes away.

any help would be greatly appreciated

like image 327
waa1990 Avatar asked Apr 29 '11 23:04

waa1990


1 Answers

This is a response to your question on the first answer. His idea is right that you need to initialize it with a location before anything can be visible. Also please note that this is a question about V3, the first answer addresses the syntax of V2. Please try the code below using the same idea as the v2 post.

Set the center value in the map options with your initial location. You can also adjust the zoom here.

var mapOptions = {
      zoom: 12,
      mapTypeId: google.maps.MapTypeId.ROADMAP,
      center: new google.maps.LatLng(latitude, longitude)
    };
var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
like image 103
Atticus Avatar answered Oct 18 '22 09:10

Atticus