-
Notifications
You must be signed in to change notification settings - Fork 0
/
qpegpsmaps_small.js
58 lines (43 loc) · 1.37 KB
/
qpegpsmaps_small.js
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
//<![CDATA[
var map;
function load() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
// map.addControl(new GScaleControl());
// map.addControl(new GOverviewMapControl());
var scale = 10;
var centre = new GLatLng(60.20, 25.0);
map.setCenter(centre, scale);
function calcScale() {
var bounds = map.getBounds();
var neb = bounds.getNorthEast();
var swb = bounds.getSouthWest();
var se = new GLatLng( swb.lat(), neb.lng() );
var dy = se.distanceFrom(swb);
// 2817 factor is the FRITZ factor - gpsdrive m/pixel scale factor
return (dy*2817.947378/800.0).toFixed(2);
}
function outputMercator() {
var bounds = map.getBounds();
var zoom = map.getZoom();
var output = document.getElementById("bounds");
var ne = bounds.getNorthEast();
var sw = bounds.getSouthWest();
var dist = calcScale();
var newtext = "<p>MERCATOR <i>name</i> "+ dist +" 600 400 ";
newtext += sw.lng() + " " + ne.lat() + " 0 0 " + ne.lng() + " ";
newtext += sw.lat() + " 600 400 </p>";
output.innerHTML = '';
output.innerHTML = newtext;
}
GEvent.addListener(map, 'moveend', function() {
outputMercator();
});
outputMercator();
}
else {
alert("Sorry, the Google Maps API is not compatible with this browser");
}
}
//]]>