source: src/django_gheat/wlheatmap/static/OpenStreetMap.js@ 9381

Last change on this file since 9381 was 9373, checked in by rick, 13 years ago

Serious effort in making the code making far more parallel calls, else it takes ages for the page to load (max-connections per domain, browser limit).

File size: 8.8 KB
Line 
1/**
2 * Namespace: Util.OSM
3 */
4OpenLayers.Util.OSM = {};
5
6/**
7 * Constant: MISSING_TILE_URL
8 * {String} URL of image to display for missing tiles
9 */
10OpenLayers.Util.OSM.MISSING_TILE_URL = "http://openstreetmap.org/openlayers/img/404.png";
11
12/**
13 * Property: originalOnImageLoadError
14 * {Function} Original onImageLoadError function.
15 */
16OpenLayers.Util.OSM.originalOnImageLoadError = OpenLayers.Util.onImageLoadError;
17
18/**
19 * Function: onImageLoadError
20 */
21OpenLayers.Util.onImageLoadError = function() {
22 if (this.src.match(/^http:\/\/[abc]\.[a-z]+\.openstreetmap\.org\//)) {
23 this.src = OpenLayers.Util.OSM.MISSING_TILE_URL;
24 } else if (this.src.match(/^http:\/\/[def]\.tah\.openstreetmap\.org\//)) {
25 // do nothing - this layer is transparent
26 } else {
27 OpenLayers.Util.OSM.originalOnImageLoadError;
28 }
29};
30
31/**
32 * Class: OpenLayers.Layer.OSM.Mapnik
33 *
34 * Inherits from:
35 * - <OpenLayers.Layer.OSM>
36 */
37OpenLayers.Layer.OSM.Mapnik = OpenLayers.Class(OpenLayers.Layer.OSM, {
38 /**
39 * Constructor: OpenLayers.Layer.OSM.Mapnik
40 *
41 * Parameters:
42 * name - {String}
43 * options - {Object} Hashtable of extra options to tag onto the layer
44 */
45 initialize: function(name, options) {
46 var url = [
47 "http://a.osmproxy.wirelessleiden.nl/heatmap/osm-proxy/${z}/${x},${y}.png",
48 "http://b.osmproxy.wirelessleiden.nl/heatmap/osm-proxy/${z}/${x},${y}.png",
49 "http://c.osmproxy.wirelessleiden.nl/heatmap/osm-proxy/${z}/${x},${y}.png",
50 "http://d.osmproxy.wirelessleiden.nl/heatmap/osm-proxy/${z}/${x},${y}.png",
51 "http://e.osmproxy.wirelessleiden.nl/heatmap/osm-proxy/${z}/${x},${y}.png",
52 "http://f.osmproxy.wirelessleiden.nl/heatmap/osm-proxy/${z}/${x},${y}.png",
53 ];
54 options = OpenLayers.Util.extend({ numZoomLevels: 19 }, options);
55 var newArguments = [name, url, options];
56 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
57 },
58
59 CLASS_NAME: "OpenLayers.Layer.OSM.Mapnik"
60});
61
62/**
63 * Class: OpenLayers.Layer.OSM.Osmarender
64 *
65 * Inherits from:
66 * - <OpenLayers.Layer.OSM>
67 */
68OpenLayers.Layer.OSM.Osmarender = OpenLayers.Class(OpenLayers.Layer.OSM, {
69 /**
70 * Constructor: OpenLayers.Layer.OSM.Osmarender
71 *
72 * Parameters:
73 * name - {String}
74 * options - {Object} Hashtable of extra options to tag onto the layer
75 */
76 initialize: function(name, options) {
77 var url = [
78 "http://a.tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png",
79 "http://b.tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png",
80 "http://c.tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png"
81 ];
82 options = OpenLayers.Util.extend({ numZoomLevels: 18 }, options);
83 var newArguments = [name, url, options];
84 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
85 },
86
87 CLASS_NAME: "OpenLayers.Layer.OSM.Osmarender"
88});
89
90/**
91 * Class: OpenLayers.Layer.OSM.CycleMap
92 *
93 * Inherits from:
94 * - <OpenLayers.Layer.OSM>
95 */
96OpenLayers.Layer.OSM.CycleMap = OpenLayers.Class(OpenLayers.Layer.OSM, {
97 /**
98 * Constructor: OpenLayers.Layer.OSM.CycleMap
99 *
100 * Parameters:
101 * name - {String}
102 * options - {Object} Hashtable of extra options to tag onto the layer
103 */
104 initialize: function(name, options) {
105 var url = [
106 "http://a.andy.sandbox.cloudmade.com/tiles/cycle/${z}/${x}/${y}.png",
107 "http://b.andy.sandbox.cloudmade.com/tiles/cycle/${z}/${x}/${y}.png",
108 "http://c.andy.sandbox.cloudmade.com/tiles/cycle/${z}/${x}/${y}.png"
109 ];
110 options = OpenLayers.Util.extend({ numZoomLevels: 19 }, options);
111 var newArguments = [name, url, options];
112 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
113 },
114
115 CLASS_NAME: "OpenLayers.Layer.OSM.CycleMap"
116});
117
118/**
119 * Class: OpenLayers.Layer.OSM.Maplint
120 *
121 * Inherits from:
122 * - <OpenLayers.Layer.OSM>
123 */
124OpenLayers.Layer.OSM.Maplint = OpenLayers.Class(OpenLayers.Layer.OSM, {
125 /**
126 * Constructor: OpenLayers.Layer.OSM.Maplint
127 *
128 * Parameters:
129 * name - {String}
130 * options - {Object} Hashtable of extra options to tag onto the layer
131 */
132 initialize: function(name, options) {
133 var url = [
134 "http://d.tah.openstreetmap.org/Tiles/maplint/${z}/${x}/${y}.png",
135 "http://e.tah.openstreetmap.org/Tiles/maplint/${z}/${x}/${y}.png",
136 "http://f.tah.openstreetmap.org/Tiles/maplint/${z}/${x}/${y}.png"
137 ];
138 options = OpenLayers.Util.extend({ numZoomLevels: 21, isBaseLayer: false, visibility: false }, options);
139 var newArguments = [name, url, options];
140 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
141 },
142
143 CLASS_NAME: "OpenLayers.Layer.OSM.Maplint"
144});
145
146/**
147 * Gheat layer
148 */
149OpenLayers.Layer.OSM.Overlay1 = OpenLayers.Class(OpenLayers.Layer.OSM, {
150 initialize: function(name, options) {
151 var url = [
152 "/gheat/classic/${z}/${x},${y}.png"
153 ];
154 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
155 var newArguments = [name, url, options];
156 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
157 },
158 colour: "0,0,0",
159 CLASS_NAME: "OpenLayers.Layer.Overlay"
160});
161
162/**
163 * All accespoints
164 */
165OpenLayers.Layer.OSM.Overlay2 = OpenLayers.Class(OpenLayers.Layer.OSM, {
166 initialize: function(name, options) {
167 var url = [
168 "http://a.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=90,90,90",
169 "http://b.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=90,90,90",
170 "http://c.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=90,90,90",
171 "http://d.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=90,90,90",
172 "http://e.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=90,90,90",
173 "http://f.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=90,90,90",
174 ];
175 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
176 var newArguments = [name, url, options];
177 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
178 },
179 colour: "90,90,90",
180 CLASS_NAME: "OpenLayers.Layer.Overlay"
181});
182
183/**
184 * Wireless Leiden nodes
185 */
186OpenLayers.Layer.OSM.Overlay3 = OpenLayers.Class(OpenLayers.Layer.OSM, {
187 initialize: function(name, options) {
188 var url = [
189 "http://a.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=255,0,0&accespoint__ssid__icontains=WirelessLeiden",
190 "http://b.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=255,0,0&accespoint__ssid__icontains=WirelessLeiden",
191 "http://c.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=255,0,0&accespoint__ssid__icontains=WirelessLeiden",
192 "http://d.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=255,0,0&accespoint__ssid__icontains=WirelessLeiden",
193 "http://e.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=255,0,0&accespoint__ssid__icontains=WirelessLeiden",
194 "http://f.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=255,0,0&accespoint__ssid__icontains=WirelessLeiden",
195 ];
196 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
197 var newArguments = [name, url, options];
198 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
199 },
200 colour: "255,0,0",
201 CLASS_NAME: "OpenLayers.Layer.Overlay"
202});
203
204/**
205 * Signal strength
206 */
207OpenLayers.Layer.OSM.Overlay4 = OpenLayers.Class(OpenLayers.Layer.OSM, {
208 initialize: function(name, options) {
209 var url = [
210 "http://a.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=250,250,0&signaal__gte=0&signaal__lte=100",
211 "http://b.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=250,250,0&signaal__gte=0&signaal__lte=100",
212 "http://c.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=250,250,0&signaal__gte=0&signaal__lte=100",
213 "http://d.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=250,250,0&signaal__gte=0&signaal__lte=100",
214 "http://e.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=250,250,0&signaal__gte=0&signaal__lte=100",
215 "http://f.maps.wirelessleiden.nl/heatmap/website/tile/${z}/${x},${y}.png?colour=250,250,0&signaal__gte=0&signaal__lte=100",
216 ];
217 options = OpenLayers.Util.extend({ numZoomLevels: 21 }, options);
218 var newArguments = [name, url, options];
219 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
220 },
221 colour: "250,250,0",
222 CLASS_NAME: "OpenLayers.Layer.Overlay"
223});
Note: See TracBrowser for help on using the repository browser.