1 /* vim: set expandtab sw=4 ts=4 sts=4: */
5 OpenLayers.Util.OSM = {};
8 * Constant: MISSING_TILE_URL
9 * {String} URL of image to display for missing tiles
11 OpenLayers.Util.OSM.MISSING_TILE_URL = "http://www.openstreetmap.org/openlayers/img/404.png";
14 * Property: originalOnImageLoadError
15 * {Function} Original onImageLoadError function.
17 OpenLayers.Util.OSM.originalOnImageLoadError = OpenLayers.Util.onImageLoadError;
20 * Function: onImageLoadError
22 OpenLayers.Util.onImageLoadError = function () {
23 if (this.src.match(/^http:\/\/[abc]\.[a-z]+\.openstreetmap\.org\//)) {
24 this.src = OpenLayers.Util.OSM.MISSING_TILE_URL;
25 } else if (this.src.match(/^http:\/\/[def]\.tah\.openstreetmap\.org\//)) {
26 // do nothing - this layer is transparent
28 OpenLayers.Util.OSM.originalOnImageLoadError;
33 * Class: OpenLayers.Layer.OSM.Mapnik
36 * - <OpenLayers.Layer.OSM>
38 OpenLayers.Layer.OSM.Mapnik = OpenLayers.Class(OpenLayers.Layer.OSM, {
40 * Constructor: OpenLayers.Layer.OSM.Mapnik
44 * options - {Object} Hashtable of extra options to tag onto the layer
46 initialize: function (name, options) {
48 "http://a.tile.openstreetmap.org/${z}/${x}/${y}.png",
49 "http://b.tile.openstreetmap.org/${z}/${x}/${y}.png",
50 "http://c.tile.openstreetmap.org/${z}/${x}/${y}.png"
52 options = OpenLayers.Util.extend({
55 transitionEffect: "resize"
57 var newArguments = [name, url, options];
58 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
61 CLASS_NAME: "OpenLayers.Layer.OSM.Mapnik"
65 * Class: OpenLayers.Layer.OSM.Osmarender
68 * - <OpenLayers.Layer.OSM>
70 OpenLayers.Layer.OSM.Osmarender = OpenLayers.Class(OpenLayers.Layer.OSM, {
72 * Constructor: OpenLayers.Layer.OSM.Osmarender
76 * options - {Object} Hashtable of extra options to tag onto the layer
78 initialize: function (name, options) {
80 "http://a.tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png",
81 "http://b.tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png",
82 "http://c.tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png"
84 options = OpenLayers.Util.extend({
87 transitionEffect: "resize"
89 var newArguments = [name, url, options];
90 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
93 CLASS_NAME: "OpenLayers.Layer.OSM.Osmarender"
97 * Class: OpenLayers.Layer.OSM.CycleMap
100 * - <OpenLayers.Layer.OSM>
102 OpenLayers.Layer.OSM.CycleMap = OpenLayers.Class(OpenLayers.Layer.OSM, {
104 * Constructor: OpenLayers.Layer.OSM.CycleMap
108 * options - {Object} Hashtable of extra options to tag onto the layer
110 initialize: function (name, options) {
112 "http://a.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png",
113 "http://b.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png",
114 "http://c.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png"
116 options = OpenLayers.Util.extend({
119 transitionEffect: "resize"
121 var newArguments = [name, url, options];
122 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
125 CLASS_NAME: "OpenLayers.Layer.OSM.CycleMap"