Leaflet

Leaflet

new Leaflet(terria, map)

Source:

The Leaflet viewer component

Parameters:
Name Type Description
terria Terria

The Terria instance.

map Map

The leaflet map instance.

Extends

Members

canShowSplitter :Boolean

Source:
Overrides:

Gets or sets whether this viewer can show a splitter.

Type:
  • Boolean

dataSourceDisplay :LeafletDataSourceDisplay

Source:

Gets the LeafletDataSourceDisplay used to render a DataSource.

Type:

map :Map

Source:

Gets or sets the Leaflet Map instance.

Type:
  • Map

terria :Terria

Source:
Inherited From:

Gets or sets the Terria instance.

Type:

Methods

(protected) _createFeatureFromImageryLayerFeature(imageryFeature) → {Feature}

Source:
Inherited From:

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.

Returns:

The created feature.

Type
Feature

addAttribution(attribution)

Source:
Overrides:

Adds an attribution to the map.

Parameters:
Name Type Description
attribution Credit

The attribution to add.

addImageryProvider(options) → {ImageryLayer}

Source:

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>
Returns:

The newly created layer.

Type
ImageryLayer

captureScreenshot() → {Promise}

Source:
Overrides:

Captures a screenshot of the map.

Returns:

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

Type
Promise

computePositionOnScreen(position, resultopt) → {Cartesian2}

Source:
Overrides:

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.

Returns:

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

Type
Cartesian2

getAllAttribution() → {Array.<String>}

Source:
Overrides:

Gets all attribution currently active on the globe or map.

Returns:

The list of current attributions, as HTML strings.

Type
Array.<String>

getContainer() → {Element}

Source:
Overrides:

Gets the current container element.

Returns:

The current container element.

Type
Element

getCurrentExtent() → {Rectangle}

Source:
Overrides:

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

Returns:

The current visible extent.

Type
Rectangle

lower(index)

Source:
Overrides:

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

lowerToBottom(item)

Source:
Overrides:

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)

notifyRepaintRequired()

Source:
Overrides:

Notifies the viewer that a repaint is required.

pickFromLocation(latlng, imageryLayerCoords, ignoreSplitter, existingFeatures)

Source:
Overrides:

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

ignoreSplitter Boolean

An optional arg to ignore the splitter and return all feature picking results. Defaults to false.

existingFeatures

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

raise(index)

Source:
Overrides:

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

removeAttribution(attribution)

Source:
Overrides:

Removes an attribution from the map.

Parameters:
Name Type Description
attribution Credit

The attribution to remove.

updateLayerOrder()

Source:

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

updateLayerOrderAfterReorder()

Source:
Overrides:

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

zoomTo(target, flightDurationSecondsopt)

Source:
Overrides:

Zooms to a specified camera view or extent.

Parameters:
Name Type Attributes Default Description
target CameraView | Rectangle | DataSource

The view, extent or DataSource 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.