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 = "http://www.openstreetmap.org/openlayers/img/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({ numZoomLevels: 19, buffer: 0,
52 attribution : '© <a target="_parent" href="http://www.openstreetmap.org">OpenStreetMap</a> and contributors, under an <a target="_parent" href="http://www.openstreetmap.org/copyright">open license</a>' }, options);
53 var newArguments = [name, url, options];
54 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
57 CLASS_NAME: "OpenLayers.Layer.OSM.Mapnik"
61 * Class: OpenLayers.Layer.OSM.MapQuestOpen
64 * - <OpenLayers.Layer.OSM>
66 OpenLayers.Layer.OSM.MapQuestOpen = OpenLayers.Class(OpenLayers.Layer.OSM, {
68 * Constructor: OpenLayers.Layer.OSM.MapQuestOpen
72 * options - {Object} Hashtable of extra options to tag onto the layer
74 initialize: function(name, options) {
76 "http://otile1.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png",
77 "http://otile2.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png",
78 "http://otile3.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png",
79 "http://otile4.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.png"
81 options = OpenLayers.Util.extend({ numZoomLevels: 19, buffer: 0 }, options);
82 var newArguments = [name, url, options];
83 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
86 CLASS_NAME: "OpenLayers.Layer.OSM.MapQuestOpen"
90 * Class: OpenLayers.Layer.OSM.CycleMap
93 * - <OpenLayers.Layer.OSM>
95 OpenLayers.Layer.OSM.CycleMap = OpenLayers.Class(OpenLayers.Layer.OSM, {
97 * Constructor: OpenLayers.Layer.OSM.CycleMap
101 * options - {Object} Hashtable of extra options to tag onto the layer
103 initialize: function(name, options) {
105 "http://a.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png",
106 "http://b.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png",
107 "http://c.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png"
109 options = OpenLayers.Util.extend({ numZoomLevels: 19, buffer: 0 }, options);
110 var newArguments = [name, url, options];
111 OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments);
114 CLASS_NAME: "OpenLayers.Layer.OSM.CycleMap"