Evening chaps - does anyone do any coding with the Google Maps API?
I only found out about it yesterday and it looks quite fun to hack about with so set about doing a simple 'you are here' from the visitor IP address.
Now I can do the google.loader.ClientLocation.address.city bit on its own and I can get a map to appear on screen centred on any long . lat but I can;t get them to work properly together.
All I want is the long / lat details from the clientlocation part and then pop a map to screen centred on those co-ords.
Think I can do it - can I buggery!
Any ideas greatly appreciated, this is the code thats been copied an pasted from example pages and will not work (please not I am not a Javascript coder, so will be grabbing a book on that shortly as well!):
Even tried it with sensor = true, false and without that query string altogether as a few reported problems with that.
I only found out about it yesterday and it looks quite fun to hack about with so set about doing a simple 'you are here' from the visitor IP address.
Now I can do the google.loader.ClientLocation.address.city bit on its own and I can get a map to appear on screen centred on any long . lat but I can;t get them to work properly together.
All I want is the long / lat details from the clientlocation part and then pop a map to screen centred on those co-ords.
Think I can do it - can I buggery!
Any ideas greatly appreciated, this is the code thats been copied an pasted from example pages and will not work (please not I am not a Javascript coder, so will be grabbing a book on that shortly as well!):
Code:
<html>
<head>
<script src="http://www.google.com/jsapi" language="javascript"></script>
<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&key=my_API_key&sensor=true"></script>
<script type="text/javascript">
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(google.loader.ClientLocation.latitude, google.loader.ClientLocation.longitude), 16);
map.setUIToDefault();
</script>
</head>
<body>
<div id="map_canvas" style="width: 500px; height: 300px"></div>
</body>
</html>
Even tried it with sensor = true, false and without that query string altogether as a few reported problems with that.