-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmap.js
30 lines (23 loc) · 930 Bytes
/
map.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
function show_preview_map(element, lat, lon, south, west, north, east, base_dir)
{
var mm = com.modestmaps;
var cm = new mm.StamenProvider('toner-lite');
var map = new mm.Map(element, cm, {x: 600, y: 400}, []);
var ext = [{lat: north, lon: west}, {lat: south, lon: east}];
map.setExtent(ext);
add_roundy_corners(map);
var img = new Image();
img.onload = function()
{
var pos = map.locationPoint({lat: lat, lon: lon});
var anc = document.createElement('a');
anc.className = 'map-link';
anc.style.width = this.width.toFixed(0) + 'px';
anc.style.height = this.height.toFixed(0) + 'px';
anc.style.left = (pos.x - this.width/2).toFixed(0) + 'px';
anc.style.top = (pos.y - this.height/2).toFixed(0) + 'px';
anc.appendChild(img);
map.parent.appendChild(anc);
}
img.src = base_dir + '/images/cross_round_lg.png';
}