Class: XYZ

cercaliagl.layer/XYZ


Raster base layer. Useful for custom baselayers.

Example usage:

const map = new cercaliagl.Map({
  target: 'map',
  center: new cercaliagl.LonLat(2.16935, 41.4046),
  zoom: 12,
});

map.whenReady(() => {
  const iccTopoLayer = new cercaliagl.layer.XYZ({
    layerId: 'icc',
    label: 'ICC Topogràfic',
    url: 'https://geoserveis.icgc.cat/icc_mapesmultibase/noutm/wmts/topo/GRID3857/{z}/{x}/{y}.jpeg',
    tileSize: 256,
  });
  const iccOrtoLayer = new cercaliagl.layer.XYZ({
    layerId: 'icc_orto',
    label: 'ICC Aerea',
    url: 'https://geoserveis.icgc.cat/icc_mapesmultibase/noutm/wmts/orto/GRID3857/{z}/{x}/{y}.jpeg',
    tileSize: 256,
  });

  map.addBaseLayer(iccTopoLayer);
  map.addBaseLayer(iccOrtoLayer);
});

new XYZ(options)

Name Type Description
options

XYZ options

Name Type Description
layerId string

Layer id.

label string

Layer label. If not specified it uses layerId value. This value is visible in module:cercaliagl/control/LayerSwitcher~LayerSwitcher.

attribution string

Attribution HTML for this layer. This value is visible in module:cercaliagl/control/Logo~Logo.

url string | Array.<string>

URL or an array of urls templates. Must include {x}, {y} and {z}.

tilesize number

Tile size in pixels. Default 256.

minzoom number

Minimum zoom level. Default 0.

maxzoom number

Maximum zoom level. Default 20.

Methods

getAttribution(){string}

Get attributon

Returns:
Attribution

getLabel(){string}

Map label used in layer switcher.

Returns:
Name

getLayerId(){string}

Get layer id

Returns:
Layer id