Can you please test this?

Soldato
Joined
16 Oct 2007
Posts
7,481
Location
UK
Hello all,

Can you just check my site here and tell me if Google Maps is pointing to the sea off Ghana? or the correct location?
 
It's pointing to Tresco on the Isles of Scilly.

EDIT: with firefox 3

EDIT: And now the link below is pointing to London !?
 
Last edited:
:confused:

So it works sometimes, and not others.

What browsers are you using please?

Simon & FF3 worked
James & IE7 didn't
 
First link goes to Tresco
Second link goes to Russell Square.
FF 3.0.4

First link goes to middle of the sea, the first time you go to the page. F5 and your back to Tresco.
Same with second link.
IE 7

Check your Ajax call in IE.
 
Thanks Simon, much appreciated.

Not that i'd know how to check an ajax call... you any good!?
 
Thanks Simon, much appreciated.

Not that i'd know how to check an ajax call... you any good!?

Try moving the google maps javascript code (the onLoad() function) to the <head> of the page and maybe change the body tag to
<body onload="onLoad()">

It may be that IE is trying to move the google map location to the correct place, before the map is drawn. When you hit F5 the map is already in cache so the javascript manages to run against it and move the location.

It's been a while since I use Google maps!

Simon
 
Also I notice,well from the page html, that your lat and long are set to empty values?
lon = document.getElementById("longi").value;
lat = document.getElementById("lati").value;

lati and longi are hidden fields which are empty.

[edit]scratch that, they are being populated by the gmap.js file in the function
showPointLatLng
[/edit]

Simon
 
Last edited:
Arrgg PHP!!!! :)

I've just had another quick look and you appear to be doing a postcode lookup twice.
Once in PHP and once in gmap.js.
I guess the php lookup is to check whether you have a lat/long for the postcode before trying to display the map.
The default for the map from gmap.js is GLatLng(54.622978,-2.592773) which I guess is the one in the sea.

The lines in the gmap.js file should be all you need
//addLoadEvent(mapLoad);
// addLoadEvent(usePointFromPostcode(document.getElementById('postcode').value, showPointLatLng));
//addUnLoadEvent(GUnload);

I think that this should, load a new map, take the postcode from the hidden postcode field, look up the lat/long from google then display the map.

OR

You could comment out the line
usePointFromPostcode(document.getElementById('postcode').value, showPointLatLng);
from gmap.js, change the sizes of your icon at the top of the gmap.js file, and then in the php file, after you've found the lat/long use:

Code:
<script type="text/javascript">
  lon = <?=$longi?>;
  lat = <?=$lati?>;

  function fnOnLoad(){
    var lmap = document.getElementById("map");
    lmap.style.display = "";
    lmap.style.height = "500px";
    lmap.style.width = "475px";
    
    var map = new GMap(lmap);
    map.addControl(new GLargeMapControl());
    map.addControl(new GOverviewMapControl());
    
    var point = new GPoint(lon, lat);
    map.centerAndZoom(point, 11);
  
    //icon already available from gmap.js
    icon.image = "/images/redpointer.gif";
    icon.iconAnchor = new GPoint(15, 39);
    icon.infoWindowAnchor = new GPoint(5, 1);

    placeMarkerAtPoint(point,icon);

 }

  addLoadEvent(fnOnLoad);
  addUnLoadEvent(GUnload);
 
Last edited:
Back
Top Bottom