42 lines
1.4 KiB
JavaScript
42 lines
1.4 KiB
JavaScript
/* Copyright (c) 2006-2012 by OpenLayers Contributors (see authors.txt for
|
|
* full list of contributors). Published under the Clear BSD license.
|
|
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the
|
|
* full text of the license. */
|
|
|
|
/**
|
|
* @requires OpenLayers/Layer/XYZ.js
|
|
*/
|
|
|
|
/**
|
|
* Class: OpenLayers.Layer.OSM
|
|
* A class to access OpenStreetMap tiles. By default, uses the OpenStreetMap
|
|
* hosted tile.openstreetmap.org 'Mapnik' tileset. If you wish to use
|
|
* tiles@home / osmarender layer instead, you can pass a layer like:
|
|
*
|
|
* (code)
|
|
* new OpenLayers.Layer.OSM("t@h",
|
|
* "http://tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png");
|
|
* (end)
|
|
*
|
|
* This layer defaults to Spherical Mercator.
|
|
*
|
|
* Inherits from:
|
|
* - <OpenLayers.Layer.XYZ>
|
|
*/
|
|
OpenLayers.Layer.OSM = OpenLayers.Class(OpenLayers.Layer.XYZ, {
|
|
name: "OpenStreetMap",
|
|
attribution: "Data CC-By-SA by <a href='http://openstreetmap.org/'>OpenStreetMap</a>",
|
|
sphericalMercator: true,
|
|
url: 'http://tile.openstreetmap.org/${z}/${x}/${y}.png',
|
|
clone: function(obj) {
|
|
if (obj == null) {
|
|
obj = new OpenLayers.Layer.OSM(
|
|
this.name, this.url, this.getOptions());
|
|
}
|
|
obj = OpenLayers.Layer.XYZ.prototype.clone.apply(this, [obj]);
|
|
return obj;
|
|
},
|
|
wrapDateLine: true,
|
|
CLASS_NAME: "OpenLayers.Layer.OSM"
|
|
});
|