Class: Leaflet

Leaflet(terria, map)

new Leaflet(terria, map)

The Leaflet viewer component

Parameters:
Name Type Description
terria Terria

The Terria instance.

map Map

The leaflet map instance.

Source:

Extends

Members

canShowSplitter :Boolean

Gets or sets whether this viewer can show a splitter.

Type:
  • Boolean
Overrides:
Source:

map :Map

Gets or sets the Leaflet Map instance.

Type:
  • Map
Source:

terria :Terria

Gets or sets the Terria instance.

Type:
Inherited From:
Source:

Methods

(protected) _createFeatureFromImageryLayerFeature(imageryFeature) → {Feature}

Creates a {@see Feature} (based on an {@see Entity}) from a {@see ImageryLayerFeatureInfo}.

Parameters:
Name Type Description
imageryFeature ImageryLayerFeatureInfo

The imagery layer feature for which to create an entity-based feature.

Inherited From:
Source:
Returns:

The created feature.

Type
Feature

addAttribution(attribution)

Adds an attribution to the map.

Parameters:
Name Type Description
attribution Credit

The attribution to add.

Overrides:
Source:

addImageryProvider(options) → {ImageryLayer}

Returns a new layer using a provided ImageryProvider. Does not add it to anything - in Leaflet there is no equivalent to Cesium's ability to add a layer without showing it, so here this is done by show/hide. Note the optional parameters are a subset of the Cesium version of this function, with one addition (onProjectionError).

Parameters:
Name Type Description
options Object

Options

Properties
Name Type Attributes Default Description
imageryProvider ImageryProvider

The imagery provider to create a new layer for.

rectangle Rectangle <optional>
imageryProvider.rectangle

The rectangle of the layer. This rectangle can limit the visible portion of the imagery provider.

opacity Number <optional>
1.0

The alpha blending value of this layer, from 0.0 to 1.0.

clipToRectangle Boolean <optional>
onLoadError function <optional>
onProjectionError function <optional>
Source:
Returns:

The newly created layer.

Type
ImageryLayer

captureScreenshot() → {Promise}

Captures a screenshot of the map.

Overrides:
Source:
Returns:

A promise that resolves to a data URL when the screenshot is ready.

Type
Promise

computePositionOnScreen(position, resultopt) → {Cartesian2}

Computes the screen position of a given world position.

Parameters:
Name Type Attributes Description
position Cartesian3

The world position in Earth-centered Fixed coordinates.

result Cartesian2 <optional>

The instance to which to copy the result.

Overrides:
Source:
Returns:

The screen position, or undefined if the position is not on the screen.

Type
Cartesian2

getAllAttribution() → {Array.<String>}

Gets all attribution currently active on the globe or map.

Overrides:
Source:
Returns:

The list of current attributions, as HTML strings.

Type
Array.<String>

getContainer() → {Element}

Gets the current container element.

Overrides:
Source:
Returns:

The current container element.

Type
Element

getCurrentExtent() → {Rectangle}

Gets the current extent of the camera. This may be approximate if the viewer does not have a strictly rectangular view.

Overrides:
Source:
Returns:

The current visible extent.

Type
Rectangle

lower(index)

Lower an item's level in the viewer This does not check that index is valid

Parameters:
Name Type Description
index Number

The index of the item to lower

Overrides:
Source:

lowerToBottom(item)

Lowers this imagery layer to the bottom, underneath all other layers. If this item is not enabled or not shown, this method does nothing.

Parameters:
Name Type Description
item CatalogItem

The item to lower to the bottom (usually a basemap)

Overrides:
Source:

notifyRepaintRequired()

Notifies the viewer that a repaint is required.

Overrides:
Source:

pickFromLocation(latlng, imageryLayerCoords, existingFeatures)

Picks features based off a latitude, longitude and (optionally) height.

Parameters:
Name Type Description
latlng Object

The position on the earth to pick.

imageryLayerCoords Object

A map of imagery provider urls to the coords used to get features for those imagery providers - i.e. x, y, level

existingFeatures

An optional list of existing features to concatenate the ones found from asynchronous picking to.

Overrides:
Source:

raise(index)

Raise an item's level in the viewer This does not check that index is valid

Parameters:
Name Type Description
index Number

The index of the item to raise

Overrides:
Source:

removeAttribution(attribution)

Removes an attribution from the map.

Parameters:
Name Type Description
attribution Credit

The attribution to remove.

Overrides:
Source:

updateLayerOrder()

Updates the order of layers on the Leaflet map to match the order in the Now Viewing pane.

Source:

updateLayerOrderAfterReorder()

Because Leaflet doesn't actually do raise/lower, just reset the orders after every raise/lower

Overrides:
Source:

zoomTo(viewOrExtent, flightDurationSecondsopt)

Zooms to a specified camera view or extent.

Parameters:
Name Type Attributes Default Description
viewOrExtent CameraView | Rectangle

The view or extent to which to zoom.

flightDurationSeconds Number <optional>
3.0

The length of the flight animation in seconds. Leaflet ignores the actual value, but will use an animated transition when this value is greater than 0.

Overrides:
Source: