Class: OSM


import OSM from 'ol/source/OSM';

Layer source for the OpenStreetMap tile server.

new OSM(opt_options)

source/OSM.js, line 49
Name Type Description

Open Street Map options.

Name Type Default Description
attributions module:ol/source/Source~AttributionLike


cacheSize number 2048

Cache size.

crossOrigin null | string

The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you are using the WebGL renderer or if you want to access pixel data with the Canvas renderer. See for more detail.

maxZoom number 19

Max zoom.

opaque boolean true

Whether the layer is opaque.

reprojectionErrorThreshold number 1.5

Maximum allowed reprojection error (in pixels). Higher values can increase reprojection performance, but decrease precision.

tileLoadFunction module:ol/Tile~LoadFunction

Optional function to load a tile given a URL. The default is

function(imageTile, src) {
  imageTile.getImage().src = src;
url string 'https://{a-c}{z}/{x}/{y}.png'

URL template. Must include {x}, {y} or {-y}, and {z} placeholders.

wrapX boolean true

Whether to wrap the world horizontally.