Google Map API

Associate
Joined
27 Jun 2006
Posts
1,473
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!):

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&amp;v=2&amp;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.
 
Gratz, You can make it so the markers have pictures. Got it here, click on the marker and a picture of your office's building appears.
 
Back
Top Bottom