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