forked from cutting-room-floor/wax
-
Notifications
You must be signed in to change notification settings - Fork 0
/
openlayers.html
118 lines (102 loc) · 3.47 KB
/
openlayers.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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Wax Manual - OpenLayers</title>
<script src='ender.js' type='text/javascript'></script>
<script src='../ext/OpenLayers.js' type='text/javascript'></script>
<script src='../build/wax.ol.js' type='text/javascript'></script>
<script src='lib/showdown.js' type='text/javascript'></script>
<script src='lib/shjs.js' type='text/javascript'></script>
<script src='lib/sh_javascript.min.js' type='text/javascript'></script>
<script src='site.js' type='text/javascript'></script>
<link href='lib/shjs.css' rel='stylesheet' type='text/css' />
<link href='../theme/controls.css' rel='stylesheet' type='text/css' />
<link href='site.css' rel='stylesheet' type='text/css' />
</head>
<body>
<div class='header'>
Wax Documentation:
<a href='index.html'>Modest Maps</a> |
<a href='openlayers.html'>OpenLayers</a> |
<a href='google.html'>Google Maps</a>
</div>
<div class='page'>
<div class='navigation'>
<ul></ul>
</div>
<div class='section'>
<pre class='md'>
The Wax toolkit also supports [OpenLayers](http://openlayers.org), though it is
**not recommended for new projects**, because it has become extremely bulky and difficult
to use correctly.
## Starting Off
You'll need
* A div on your page
* Including OpenLayers.js, the core library. **Do not use the hosted version** unless absolutely necessary - the openlayers.org server is not very fast or reliable, and the version that's hosted includes all dependencies, making it extremely large.
</pre>
</div>
<pre class='md'>
### MBTiles layers in OpenLayers
The tilesets that TileStream serves and TileMill creates are valid in the
[TMS specification](http://wiki.osgeo.org/wiki/Tile_Map_Service_Specification),
for which OpenLayers has a layer type.
</pre>
<div class='section'>
<div id='openlayers-simple' class='map dark'>
<span class='attribution'>
<a href='http://mapbox.com/tileset/world-glass'>World Glass</a>
</span>
</div>
<pre class='sh_javascript run'>
OpenLayers.ImgPath = "http://js.mapbox.com/theme/dark/";
var map = new OpenLayers.Map('openlayers-simple', {
units: 'm',
projection: new OpenLayers.Projection("EPSG:900913"),
maxExtent: new OpenLayers.Bounds(-20037508.34,
-20037508.34,
20037508.34,
20037508.34),
});
map.addLayer(new OpenLayers.Layer.TMS('world-glass',
'http://a.tiles.mapbox.com/mapbox/', {
maxResolution: 156543.0339,
type: 'png',
layername: 'world-glass'
}));
map.zoomTo(1);
</pre>
</div>
<pre class='md'>
### OpenLayers Interaction
</pre>
<div class='section'>
<div id='openlayers-interaction' class='map dark'>
<span class='attribution'>
<a href='http://mapbox.com/tileset/world-glass'>World Glass</a>
</span>
</div>
<pre class='sh_javascript run'>
OpenLayers.ImgPath = "http://js.mapbox.com/theme/dark/";
var map = new OpenLayers.Map('openlayers-interaction', {
units: 'm',
projection: new OpenLayers.Projection("EPSG:900913"),
maxExtent: new OpenLayers.Bounds(-20037508.34,
-20037508.34,
20037508.34,
20037508.34),
});
map.addLayer(new OpenLayers.Layer.TMS('Properties',
'http://a.tiles.mapbox.com/devseed/', {
maxResolution: 156543.0339,
type: 'png',
layername: 'excess-properties'
}));
map.addControl(new wax.ol.Interaction());
map.zoomTo(1);
</pre>
</div>
</div>
</body>
</html>