XYZ

Represents an imagery tiles source provider.

Constructor

new XYZ(name, options:)

Parameters:
NameTypeAttributesDefaultDescription
namestring

Layer name.

options:IXYZParams
options.opacitynumber<optional>
1.0

Layer opacity.

options.subdomainsArray.<string><optional>
['a','b','c']

Subdomains of the tile service.

options.minZoomnumber<optional>
0

Minimal visibility zoom level.

options.maxZoomnumber<optional>
0

Maximal visibility zoom level.

options.minNativeZoomnumber<optional>
0

Minimal available zoom level.

options.maxNativeZoomnumber<optional>
19

Maximal available zoom level.

options.attributionstring<optional>

Layer attribution that displayed in the attribution area on the screen.

options.isBaseLayerboolean<optional>
false

Base layer flag.

options.visibilityboolean<optional>
true

Layer visibility.

options.crossOriginstring<optional>
true

If true, all tiles will have their crossOrigin attribute set to ''.

options.urlstring

Tile url source template(see example below).

options.textureFilterstring

texture gl filter. NEAREST, LINEAR, MIPMAP, ANISOTROPIC.

options.urlRewritefunction

Url rewrite function.

Fires:
  • EventsHandler#event:load
  • EventsHandler#event:loadend
Example

Creates OpenStreetMap base tile layer

new og.layer.XYZ("OpenStreetMap", {
    isBaseLayer: true,
    url: "http://b.tile.openstreetmap.org/{z}/{x}/{y}.png",
    visibility: true,
    attribution: 'Data @ <a href="http://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="http://www.openstreetmap.org/copyright">ODbL</a>'
});

Extends

Members

_id

Overrides

(protected) _pickingColor :Vec3

Layer picking color. Assign when added to the planet.

Type:

isIdle

planet

Returns planet instance.

Overrides

Methods

(abstract, protected) _assignPlanet(planet)

Assign the planet.

Parameters:
NameTypeDescription
planetPlanet

Planet render node.

(abstract, protected) _bindPicking()

Assign picking color to the layer.

(protected) _correctFullExtent()

(abstract, protected) _createUrl(segment) → {string}

Creates query url.

Parameters:
NameTypeDescription
segmentSegment

Creates specific url for current segment.

Returns:
  • Returns url string.
Type: 
string

(protected) _getHTTPRequestString(segment) → {string}

Returns actual url query string.

Parameters:
NameTypeDescription
segmentSegment

Segment that loads image data.

Returns:
  • Url string.
Type: 
string

abortLoading()

Abort loading tiles.

addTo(planet)

Adds layer to the planet.

Parameters:
NameTypeDescription
planetPlanet

Adds layer to the planet.

Overrides

bringToFront()

Set zIndex to the maximal value depend on other layers on the planet.

(abstract) clear()

Clears layer material.

Overrides

flyExtent()

Fly extent.

getAttribution() → {string}

Gets layer attribution.

Returns:

Layer attribution

Type: 
string

getExtent() → {Extent}

Gets layer extent.

Returns:
  • Layer geodetic extent.
Type: 
Extent

getExtentMerc() → {Extent}

Gets layer web-mercator extent.

Returns:
  • Layer extent.
Type: 
Extent

getHeight() → {number}

Gets layer height.

Returns:
Type: 
number

getID() → {string}

Gets layer identifier.

Overrides
Returns:
  • Layer object id.
Type: 
string

getVisibility() → {boolean}

Gets layer visibility.

Returns:
  • Layer visibility.
Type: 
boolean

getZIndex() → {number}

Gets z-index.

Returns:
Type: 
number

(abstract) hasImageryTiles() → {boolean}

Returns true if a layer has imagery tiles.

Returns:
  • Imagery tiles flag.
Type: 
boolean

isBaseLayer() → {boolean}

Returns true if the layer is a base.

Returns:
  • Base layer flag.
Type: 
boolean

isEqual(layer) → {boolean}

Compares layers instances.

Parameters:
NameTypeDescription
layerLayer

Layer instance to compare.

Overrides
Returns:
  • Returns true if the layers is the same instance of the input.
Type: 
boolean

(abstract) loadMaterial(material, forceLoadingopt)

Start to load tile material.

Parameters:
NameTypeAttributesDefaultDescription
materialMaterial

Loads current material.

forceLoadingboolean<optional>
false

remove() → {Layer}

Removes from planet.

Overrides
Returns:

-This layer.

Type: 
Layer

setAttribution(html)

Sets layer attribution text.

Parameters:
NameTypeDescription
htmlstring

HTML code that represents layer attribution, it could be just a text.

setBaseLayer(isBaseLayer)

Sets base layer type true.

Parameters:
NameTypeDescription
isBaseLayerboolean

setExtent(extent)

Sets visible geographical extent.

Parameters:
NameTypeDescription
extentExtent

Layer visible geographical extent.

setHeight(height)

Sets height over the ground.

Parameters:
NameTypeDescription
heightnumber

Layer height.

setUrl(url)

Sets imagery tiles url source template.

Parameters:
NameTypeDescription
urlstring

Url template.

Example
http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png
where {z}, {x} and {y} - replaces by current tile values, {s} - random domain.

setUrlRewriteCallback(ur)

Sets url rewrite callback, used for custom url rewriting for every tile loading.

Parameters:
NameTypeDescription
urfunction

The callback that returns tile custom created url.

setVisibility(visibility)

Sets layer visibility.

Parameters:
NameTypeDescription
visibilityboolean

Layer visibility.

setZIndex(zIndex)

Sets z-index.

Parameters:
NameTypeDescription
zIndexnumber

Layer z-index.

viewExtent()

View extent.