PDA

View Full Version : Google Maps



bravo14
Jan 18th, 2011, 09:22 AM
Hi

I have just started looking at the Google maps, and have atutorial that will get the co-ordinates. What I want this to do, is then populate two fields on a form one called longitude and one called latitude


function usePointFromPostcode(postcode, callbackFunction) {

localSearch.setSearchCompleteCallback(null,
function() {

if (localSearch.results[0]) {
var resultLat = localSearch.results[0].lat;
var resultLng = localSearch.results[0].lng;
var point = new GLatLng(resultLat,resultLng);
callbackFunction(point);
}else{
alert("Postcode not found!");
}
});

localSearch.execute(postcode + ", UK");
}

Any ideas/tips would be be much appreciated

xelawho
Jan 19th, 2011, 03:55 PM
I suspect that you would set those fields up as divs, capture the lat and lang coordinates as they get processed within your function and then write them to the divs using innerHTML

here is a simple example (http://econym.org.uk/gmap/example_map2.htm) that works on a similar concept

I don't know if it will work in your case, but I can't see why it wouldn't