My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!--
Copyright 2008 Google Inc.
Licensed under the Apache License, Version 2.0:
http://www.apache.org/licenses/LICENSE-2.0
-->
<html>
<head>
<script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAA-O3c-Om9OcvXMOJXreXHAxQGj0PqsCtxKvarsoS-iqLdqZSKfxS27kJqGZajBjvuzOBLizi931BUow"></script>
<script>
google.load("maps", "2", {callback: initialize});

function initialize() {
// Initialize default values
var zoom = 3;
var latlng = new google.maps.LatLng(37.4419, -100.1419);
var location = "Showing default location for map.";

// If ClientLocation was filled in by the loader, use that info instead
if (google.loader.ClientLocation) {
zoom = 13;
latlng = new google.maps.LatLng(google.loader.ClientLocation.latitude, google.loader.ClientLocation.longitude);
location = "Showing IP-based location: <b>" + getFormattedLocation() + "</b>";
}

document.getElementById("location").innerHTML = location;
var map = new google.maps.Map2(document.getElementById('map'));
map.setCenter(latlng, zoom);
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
}

function getFormattedLocation() {
if (google.loader.ClientLocation.address.country_code == "US" &&
google.loader.ClientLocation.address.region) {
return google.loader.ClientLocation.address.city + ", "
+ google.loader.ClientLocation.address.region.toUpperCase();
} else {
return google.loader.ClientLocation.address.city + ", "
+ google.loader.ClientLocation.address.country_code;
}
}

</script>
</head>
<body>
<div style="width:500;height:300" id="map"></div>
<div id="location"></div>
</body>
</html>

Change log

r2359 by pamela.fox on Apr 1, 2009   Diff
Adding copyright and license notice to
every file
Go to: 
Project members, sign in to write a code review

Older revisions

r2246 by pamela.fox on Aug 22, 2008   Diff
Debugging ClientLocation sample
r2245 by pamela.fox on Aug 22, 2008   Diff
Debugging ClientLocation sample
r2244 by pamela.fox on Aug 22, 2008   Diff
Debugging ClientLocation sample
All revisions of this file

File info

Size: 1736 bytes, 49 lines

File properties

svn:mime-type
text/html
svn:executable
*
Powered by Google Project Hosting