views:

862

answers:

6

2 days ago, I was working on a project that involves google maps. The website showed the maps on the pages just fine.

Now, I come back to my workstation, nothing has changed, expect for the fact that the google maps won't show up anymore. The code is identical, nobody has touched my machine since I was gone, I've checked the html, everything is perfect and still this isn't working... The Javascript console is giving no errors and the code is identical to a backup I make everytime I call it a day. 2 days ago it was working, today it isn't.

I've even copied the source code, put it into an html file and tried that, but the same result. I'm at a loss here. This is my code:

<script type="text/javascript">
      //<![CDATA[
      var map;
      var directionsPanel;
      var directions;

      function initialize() {
        if (GBrowserIsCompatible()) {
         map = new GMap2(document.getElementById("map"));
         map.addControl(new GLargeMapControl());
         map.addControl(new GScaleControl());
         map.addControl(new GMapTypeControl());

         //the route description
         directionsPanel = document.getElementById("route");
         directions = new GDirections(map, directionsPanel);
         directions.load({COMMAND});
        }
      }
      //]]>
    </script>

The {COMMAND} is something that the PHP template will parse, I've checked it, the format is 100% correct and like I allready said, code now is identical to the backup, and if it worked back then, it should work now.

Did google update their API overnight and did a function that I use here become deprecated? I don't know what's going on here...

+1  A: 

I'd suggest using some kind of HTTP sniffing proxy like Charles (costs money, free trial). I believe there may be a similar app for Firefox, but I love Charles. It shows every request your browser makes, and the response back from the server. Then you can look through it, and see if anything looks off or funny, maybe get you closer to solving the problem.

davr
No need for a pay app. Install the Firebug addon for Firefox. It has a 'Net' tab that can be activated to show all requests and responses, including headers, successful and failed ajax responses, etc.
Soviut
+1  A: 

Fiddler is a great HTTP proxy tool and it is free. It should help you determine the issue.

http://www.fiddler2.com/fiddler2/

You may want to consider locking your code to use a specific version of the google maps api (e.g. http://maps.google.com/maps?file=api&amp;v=2.106&amp;....) to avoid any issues where updates to maps API may break your code if it's mission critical.

J. Scarbrough
+1  A: 

Okay, you didn't post all of your code so I had to make a few assumptions.

What I think you are seeing when you load the page is either a grey box with the Google logo, the zoom control, and the map type selector or a mostly white page with the Google logo cut off at the top.

If you are seeing the mostly white page with the cutoff Google logo, make sure you specify the size of the DIV that is supposed to contain the map.

If you are seeing the grey box with only the controls(which is my guess), you must specify a center-point when creating a map. Like so:

if (GBrowserIsCompatible()) {
     map = new GMap2(document.getElementById("map"));
     map.setCenter(new GLatLng(LAT,LONG), ZOOM);
     ...

I think that will fix your problem. I don't know how it would be working one minute and not the next, something MUST have changed, the API did not (thankfully). This error will not put anything in the Javascript error console. I hope this helps!!!

bobert5064
A: 

Did you find a solution, yet? I'm experiencing the same difficulty. Like you, I've changed nothing on my page.

Have you tried using a different ApiKey?

A: 

hi friends. mine was working but it's showing a totally white page now. It could be due to the large number of requests?

abzarak
A: 

nce again Google maps crashes and is out of action for 4 hours today (8th April 2010) from 12.32pm to 4.32pm . Why will Google never release or publise this ! This happens every few weeks.

The accuracy, sla and support is very poor and no professional would use Google maps for business !

Did you know that Google were refused a UK postcode license ? Maybe they should leaving mapping to specialists like viamichelin or mappy.

Johny Adams