-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmapBase.html
More file actions
106 lines (100 loc) · 3.12 KB
/
mapBase.html
File metadata and controls
106 lines (100 loc) · 3.12 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<html>
<head>
<!--
//
// mapBase.html
// LocationApp
//
// Created by James Hannah on 05/09/2009.
// Copyright 2009 James Hannah. All rights reserved.
//
-->
<title>CoreLocation Demo Map HTML View</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
<script type="text/javascript" charset="utf-8">
var map;
var lastPos;
var yourPosMarker;
var geocoder;
function initialize() {
var latlng = new google.maps.LatLng(0,0);
var myOptions = {
zoom: 13,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP,
disableDefaultUI: true,
navigationControl: true,
navigationControlOptions: {
style: google.maps.NavigationControlStyle.SMALL
}
};
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
showInitialWelcome();
}
function showInitialWelcome() {
var markerloc = new google.maps.LatLng(0,0)
var iwDiv = document.createElement('div');
iwDiv.setAttribute('class', 'infoPopup')
iwDiv.innerHTML = "Press Get Location!"
var infoWindow = new google.maps.InfoWindow({
content: iwDiv
});
var marker = new google.maps.Marker({
position: markerloc,
map: map,
title: "Press \"Get Location\""
});
infoWindow.open(map, marker)
}
function displayMapForCoords(lat, lng, acc) {
coordsLoc = new google.maps.LatLng(lat,lng);
lastPos = coordsLoc;
if(!yourPosMarker) {
yourPosMarker = new google.maps.Marker({
position: coordsLoc,
map: map,
title: "Your Location"
});
map.panTo(coordsLoc)
} else {
yourPosMarker.set_position(coordsLoc);
}
return true;
}
function geocodeLastPosition() {
if(geocoder){
geocoder.geocode({'latlng': lastPos}, function(results, status) {
if(status == google.maps.GeocoderStatus.OK) {
return results;
} else {
return false;
}
})
} else {
return false;
}
}
function redisplayMap() {
map.panTo(lastPos)
}
</script>
<style>
body {
margin: 0px;
}
.infoPopup {
font-family: "Lucida Grande";
font-weight: bold;
margin: 0px;
padding: 0px;
text-align: center;
padding-top: 13px;
font-size:12pt
}
</style>
</head>
<body id="mapbase" onload="initialize()">
<div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>