forked from springmeyer/grid_renderer_example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
128 lines (101 loc) · 3.76 KB
/
index.html
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>OpenLayers Grid Interaction</title>
<style>
html, body { height: 100%; }
body {margin: 0px;}
#map {
width: 100%;
height: 100%;
}
a {
color: white;
}
.title {
z-index:999999;
position:absolute;
background:#333;
color:#fff;
padding:10px;
right:10px;
top:10px;
max-width:300px;
}
// css expected by wax interaction library
.wax-legends {
position:absolute;
left:10px;
bottom:10px;
z-index:999999;
}
.wax-legends .wax-legend {
padding:10px;
background:#333;
color:#fff;
}
.wax-tooltip {
z-index:999999;
position:absolute;
background:#333;
color:#fff;
padding:10px;
left:10px;
top:10px;
max-width:300px;
}
.wax-tooltip .close {
display:block;
position:absolute;
top:0px;
right:0px;
}
</style>
<!-- external -->
<!--<script src="http://openlayers.org/api/OpenLayers.js" type="text/javascript"></script>-->
<!--<script src="http://code.jquery.com/jquery-1.5.2.min.js" type="text/javascript"></script>-->
<!-- localized by Makefile, so we can go offline -->
<script src="ext/reqwest.min.js" type="text/javascript"></script>
<script src="ext/OpenLayers.js" type="text/javascript"></script>
<!-- connector -->
<script src="dist/wax.ol.min.js" type="text/javascript"></script>
<script type="text/javascript">
var map;
function init() {
OpenLayers.Util.onImageLoadError = function(){this.src='http://www.openlayers.org/api/img/blank.gif';}
OpenLayers.Tile.Image.useBlankTile=false;
// Options for World Map in Google Spherical Mercator Projection
var options = {
maxResolution: 156543.0339,
units: 'm',
projection: new OpenLayers.Projection("EPSG:900913"),
displayProjection: new OpenLayers.Projection("EPSG:4326"),
maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34),
controls: [
// basic click, drag
new OpenLayers.Control.Navigation({ zoomWheelEnabled: true }),
// we don't need image controls, likely broken anyway if we locally download OL
//new OpenLayers.Control.PanZoom(),
// will automatically detect TMS layers and look for "layer.json" and "z/x/y.grid.json"
new wax.ol.Interaction()
]
};
map = new OpenLayers.Map("map", options);
/* relative tile directory used in Makefile */
var url = "tiles/"
// TMS layer - same as OSM except the Y is flipped
var tms = new OpenLayers.Layer.TMS("Local Cache", url,
{ serviceVersion: "1.0.0", layername: "world", type: "png" }
);
map.addLayers([tms]);
map.zoomToMaxExtent();
map.zoomIn();
}
</script>
</head>
<body onload="init();">
<div id="map">
<div class="title">OpenLayers Grid Interaction (<a href="http://trac.mapnik.org/wiki/MapnikRenderers#grid_renderer">more info</a>)</div>
</div>
</body>
</html>