Class layer

A tile layer is a view on the map containing an array of rectangular content.

class

layer

Index

Constructor methods

Methods

Constructor methods

constructor(id: string, useBackdrop?: boolean, maxConcurrentRequests?: number): layer

Parameters

  • id: string
  • useBackdrop?: boolean optional
  • maxConcurrentRequests?: number optional

Returns

layer

Methods

public compose(extentsMapUnits: envelope, extentsDeviceUnits: envelope): { quadCollection: 'mapsjs'.tile.quad[]; endpointCollection: string[]; idxMinX: number; idxMinY: number; ulX: number; ulY: number; }

Composes an array of quadtiles with composition information and requestor endpoints. This can be used to create static images or print-ready versions of this tile layer at arbitrary extents (both source and target) For example: If you needed a 5x3 inch 300 dpi output you can specify extents in device units to be 1500x900. This function determines the correct zoom level so that the source extents fits in the target extents to the nearest integer zoom level.

Parameters

  • extentsMapUnits: envelope

    Source extents in map units.

  • extentsDeviceUnits: envelope

    Target extents in pixels.

Returns

{ quadCollection: 'mapsjs'.tile.quad[]; endpointCollection: string[]; idxMinX: number; idxMinY: number; ulX: number; ulY: number; }

Composed object in the form {quadCollection, endpointCollection, idxMinX, idxMinY, ulX, ulY } where quadCollection is an array of quad objects, endpointCollection is an array of REST endpoints from which to obtain the tiled content, idxMinX and idxMinY are the minimum x and y tile indicies of the collection respectively, and ulX and ulY are the offset in pixels of the upper left tile from the upper left target extents.

public dispose()

Unbind all associations with this tile layer to facilitate garbage collection

public getDescriptor(): any

Returns the tile layer's descriptor, which describes how requested content is rendered or styled.

Returns

any

The tile layer's descriptor.

public getId(): string

Gets ID associated with this tile layer.

Returns

string

ID of the layer.

public getIsVisible(): boolean

Gets the visibility state of this tile layer.

Returns

boolean

Whether or not this layer is visible.

public getMaxZoomLevel(): number

Gets maximum zoom level where this tile layer is visible.

Returns

number

The maximum zoom level.

public getMinZoomLevel(): number

Gets minimum zoom level where this tile layer is visible.

Returns

number

The minimum zoom level.

public getOpacity(): number

Gets the opacity of this tile layer.

Returns

number

Opacity as a decimal.

public getRenderer(): renderer

Returns this tile layer's renderer if it exists, which defines how geometry data for a quadView is rendered.

Returns

renderer

The renderer object.

public getRequestor(): requestor

Returns this tile layer's requestor which defines what kind of content to get and where to get it.

Returns

requestor

This tile layer's requestor.

public getUseBackdrop(): boolean

Determines whether this tile layer uses a backdrop.

Returns

boolean

Whether or not the layer uses a backdrop.

public notifyDescriptorChange()

Notifies the tile layer to check for changes to its descriptor.

public notifyRendererChange()

Notifies the tile layer to check for changes to its renderer.

public preload(extents: envelope, startZoomLevel: number, endZoomLevel: number)

Instructs the tile loader to populate a specified tile pyramid. This is used to fetch content (e.g. bitmap tiles) and preload it into the browser cache.

Parameters

  • extents: envelope

    Envelope for which to fetch content.

  • startZoomLevel: number

    Minimum zoom level for which to fetch content.

  • endZoomLevel: number

    Maximum zoom level for which to fetch content.

public setDescriptor(d: any)

Sets the tile layer's descriptor, which describes how requested content is rendered or styled.

Parameters

  • d: any

    A descriptor for this tile layer.

public setEnableTileFadeIn(fadeIn: boolean)

Enables or disables the fade in on tile content, which defaults to enabled.

Parameters

  • fadeIn: boolean

    Whether or not fade in on tile content should be enabled.

public setIsVisible(v: boolean)

Sets visibility state of this tile layer.

Parameters

  • v: boolean

    Whether this layer should be visible or not.

public setMaxZoomLevel(maxZ: number)

Sets maximum zoom level where this tile layer is visible.

Parameters

  • maxZ: number

    The desired maximum zoom level.

public setMinZoomLevel(minZ: number)

Sets minimum zoom level where this tile layer is visible.

Parameters

  • minZ: number

    The desired minimum zoom level.

public setNotifyErrorAction(action: () => void)

Sets the default action to take on error.

Parameters

  • action: () => void

    Function to execute on error.

public setNotifyLoadingQueueHasEmptiedAction(action: () => void)

Sets an optional function to be called when the tile loading queue for this layer has emptied.

Parameters

  • action: () => void

    Callback function.

public setNotifyLoadingQueueProgressAction(action: (tilesLoaded: number, tilesTotal: number) => void)

Sets the optional function to be called by this layer's tile loader during processing. The supplied progress function takes tiles loaded and tiles total parameters.

Parameters

  • action: (tilesLoaded: number, tilesTotal: number) => void

    Callback of the signature action(tileLoaded, tilesTotal).

public setOpacity(o: number)

Sets opacity of this tile layer.

Parameters

  • o: number

    Opacity as a decimal.

public setRenderer(r: any)

Sets optional renderer which defines how geometry data for quadView is rendered.

Parameters

  • r: any

    The renderer delegate function with signature renderer(quadview).

public setRequestProcessor(processorFunc: (requestor: 'mapsjs'.tile.requestor, descriptor: any, quad: 'mapsjs'.tile.quad, timeoutMs: number, completeAction: (img: HTMLElement) => void, errorAction: (msg: string) => void) => void)

Sets optional request processor for this tile layer. This is an advanced feature allowing developers to tap into tile request pipeline for purposes of customizing requests or manage custom caching. This is also the mechanism used for offline apps with frameworks such as phonegap.

Parameters

  • processorFunc: (requestor: 'mapsjs'.tile.requestor, descriptor: any, quad: 'mapsjs'.tile.quad, timeoutMs: number, completeAction: (img: HTMLElement) => void, errorAction: (msg: string) => void) => void

public setRequestor(req: requestor, desc?: any)

Sets this tile layer's requestor, which defines what kind of content to get and where to get it.

Parameters

  • req: requestor

    A requestor object.

  • desc?: any optional

public setRetainInterlevelContent(retain: boolean)

Sets whether or not to retain and display previous level tile content as you change tile levels to provide a nice zoom level change effect. Once the next level is loaded the old level content is always discarded. This should be set to false if there is translucent content to display. Defaults to true (prior to version 9.0.0001 this value had the same state as useBackdrop.)

Parameters

  • retain: boolean

public setTileBleedPix(bleed: number)

Sets pixel bleed on quadTiles, which defaults to 1. Setting this to zero for overlay layers with translucent polygon fills is recommended. Bleed overlap can create faint lines at tile boundries when fill is not opaque.

Parameters

  • bleed: number

    The number of pixels to bleed.