4 OpenLayers.Util.OSM = {};
7 * Constant: MISSING_TILE_URL
8 * {String} URL of image to display for missing tiles
10 OpenLayers.Util.OSM.MISSING_TILE_URL = OpenLayers.Util.getImagesLocation() + "404.png";
13 * Property: originalOnImageLoadError
14 * {Function} Original onImageLoadError function.
16 OpenLayers.Util.OSM.originalOnImageLoadError = OpenLayers.Util.onImageLoadError;
19 * Function: onImageLoadError
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
27 OpenLayers.Util.OSM.originalOnImageLoadError;
32 * Class: OpenLayers.Layer.OSM.Mapnik
35 * - <OpenLayers.Layer.OSM>
37 OpenLayers.Layer.OSM.Mapnik = OpenLayers.Class(OpenLayers.Layer.OSM, {
39 * Constructor: OpenLayers.Layer.OSM.Mapnik
43 * options - {Object} Hashtable of extra options to tag onto the layer
45 initialize: function(name, options) {
47 "http://a.tile.openstreetmap.org/${z}/${x}/${y}.png",
48 "http://b.tile.openstreetmap.org/${z}/${x}/${y}.png",
49 "http://c.tile.openstreetmap.org/${z}/${x}/${y}.png"
51 options = OpenLayers.Util.extend({
54 transitionEffect: "resize"
56 var newArguments = [name, url, options];
57 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
60 CLASS_NAME: "OpenLayers.Layer.OSM.Mapnik"
64 * Class: OpenLayers.Layer.OSM.CycleMap
67 * - <OpenLayers.Layer.OSM>
69 OpenLayers.Layer.OSM.CycleMap = OpenLayers.Class(OpenLayers.Layer.OSM, {
71 * Constructor: OpenLayers.Layer.OSM.CycleMap
75 * options - {Object} Hashtable of extra options to tag onto the layer
77 initialize: function(name, options) {
79 "http://a.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png",
80 "http://b.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png",
81 "http://c.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png"
83 options = OpenLayers.Util.extend({
86 transitionEffect: "resize"
88 var newArguments = [name, url, options];
89 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
92 CLASS_NAME: "OpenLayers.Layer.OSM.CycleMap"
96 * Class: OpenLayers.Layer.OSM.TransportMap
99 * - <OpenLayers.Layer.OSM>
101 OpenLayers.Layer.OSM.TransportMap = OpenLayers.Class(OpenLayers.Layer.OSM, {
103 * Constructor: OpenLayers.Layer.OSM.TransportMap
107 * options - {Object} Hashtable of extra options to tag onto the layer
109 initialize: function(name, options) {
111 "http://a.tile2.opencyclemap.org/transport/${z}/${x}/${y}.png",
112 "http://b.tile2.opencyclemap.org/transport/${z}/${x}/${y}.png",
113 "http://c.tile2.opencyclemap.org/transport/${z}/${x}/${y}.png"
115 options = OpenLayers.Util.extend({
118 transitionEffect: "resize"
120 var newArguments = [name, url, options];
121 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
124 CLASS_NAME: "OpenLayers.Layer.OSM.TransportMap"