Ahh, thanks mate, now that makes sense.
Any idea how to do that, ive tried changing the java to :
function closestMarkerSearch(map, markers, zoom, address) {
var addressuk = address + ", uk";
if (markers.length == 0) {
throw new Exception('No markers given');
}
new GClientGeocoder().getLatLng(addressuk, function(latLng) {
if (latLng === null) {
alert('Please enter a postcode');
} else {
var distance;
var closestDistance = null;
var closestMarker = null;
for (var i = 0; i < markers.length; i++) {
distance = latLng.distanceFrom(markers[i].getLatLng());
if (closestDistance === null || distance < closestDistance)
{
closestDistance = distance;
closestMarker = markers[i];
}
}
map.setZoom(zoom);
map.setCenter(closestMarker.latLng);
GEvent.trigger(closestMarker, 'click');
}
});
}
Im not sure where to look in fire bug to see the results.. ive not used it
before, however it's still pointing to the wrong place ?
According to firebug its coming back as : LE2 4 if im reading it right.
Regards
Matt.
-----Original Message-----
From: Andrew Leach [mailto:[email protected]]
Sent: 04 December 2009 10:35 AM
To: Google Maps API
Subject: Re: UK Post code search problem
On Dec 4, 10:08 am, "[email protected]" <[email protected]> wrote:
>
> So i can only assume somewhere its mixing up the LE2 1YA for LE12
If you use Firebug and see what is actually being returned for that
request, it's nowhere near Leicester at all!
"name": "LE2 1YA"
"address": "Le2 Rd, Lebec, CA 93243, USA"
"coordinates": [ -118.8712922, 34.8452947, 0 ]
> Can anyone shead some light on this its a real pain in the behind...
The geocoder is US-biased by default. You could add ", UK" to all your
requests (in the code) to force it to try the UK first. Bear in mind
that postcode geocoding ignores at least the last two letters and may
still make mistakes -- see Issue 1179
http://code.google.com/p/gmaps-api-issues/issues/detail?id=1179
Andrew
--
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-api?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-api?hl=en.