# OpenLayers.Layer.OSM

This layer allows accessing OpenStreetMap tiles. By default the OpenStreetMap hosted tile.openstreetmap.org Mapnik tileset is used. If you wish to use a different layer instead, you need to provide a different URL to the constructor. Here’s an example for using OpenCycleMap:

>     new OpenLayers.Layer.OSM("OpenCycleMap",
>       ["http://a.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png",
>        "http://b.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png",
>        "http://c.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png"]);

#### Inherits from

- OpenLayers.Layer.XYZ

Summary

OpenLayers.Layer.OSM | This layer allows accessing OpenStreetMap tiles.
Properties |
name | {String} The layer name.
url | {String} The tileset URL scheme.
attribution | {String} The layer attribution.
sphericalMercator | {Boolean}
wrapDateLine | {Boolean}
tileOptions | {Object} optional configuration options for OpenLayers.Tile instances created by this Layer.
Constructor |
OpenLayers.Layer.OSM |
Functions |
clone |

### Properties

### name

{String} The layer name. Defaults to “OpenStreetMap” if the first argument to the constructor is null or undefined.

### url

{String} The tileset URL scheme. Defaults to

>     http://[a|b|c].tile.openstreetmap.org/${z}/${x}/${y}.png

(the official OSM tileset) if the second argument to the constructor is null or undefined. To use another tileset you can have something like this:

>     new OpenLayers.Layer.OSM("OpenCycleMap",
>       ["http://a.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png",
>        "http://b.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png",
>        "http://c.tile.opencyclemap.org/cycle/${z}/${x}/${y}.png"]);

### attribution

{String} The layer attribution.

### sphericalMercator

{Boolean}

### wrapDateLine

{Boolean}

### tileOptions

{Object} optional configuration options for OpenLayers.Tile instances created by this Layer. Default is

>     {crossOriginKeyword: 'anonymous'}

When using OSM tilesets other than the default ones, it may be necessary to set this to

>     {crossOriginKeyword: null}

if the server does not send Access-Control-Allow-Origin headers.

### Constructor

### OpenLayers.Layer.OSM

#### Parameters

name | {String} The layer name.
url | {String} The tileset URL scheme.
options | {Object} Configuration options for the layer. Any inherited layer option can be set in this object (e.g. OpenLayers.Layer.Grid.buffer).

### Functions

### clone

> clone: function( | obj | )

> clone: function( | obj | )

The XYZ class is designed to make it easier for people who have tiles arranged by a standard XYZ grid.
{Integer} Used only when in gridded mode, this specifies the number of extra rows and colums of tiles on each side which will surround the minimum grid tiles to cover the map.
Close