Skip to content

Latest commit

 

History

History
87 lines (52 loc) · 3.56 KB

Bing.md

File metadata and controls

87 lines (52 loc) · 3.56 KB

L.BingLayer

A Leaflet basemap provider based on Bing Maps REST Services.

L.BingLayer extends L.TileLayer.

Feature highlights:

  • proper dynamic attribution.
  • metadata requested only after layer actually added on map (important, as such requests are billable).
  • most common TileLayer options supported: detectRetina, maxNativeZoom, and so on.

API

Usage example

L.bingLayer('[YOUR_BING_MAPS_KEY]').addTo(map);

Creation

Factory: L.bingLayer(<String> key?, <Object> options)

Instantiates a Bing layer object given key and options arguments (both optional).

Can be used with single options argument, if it contains key property.

Options

Option Type Default Description
imagerySet String 'Aerial' Any valid imagerySet (except Birdseye* and Streetside).
Note: default is subject to change on next major version.
culture String '' Any valid culture code.
style String '' Custom Map Style string.
retinaDpi String 'd2' Used to render larger lables when detectRetina option is active.
The value of this option is added to tile query url as additional parameter &dpi=d2.
Note: this is not documented in REST API docs (but working).

Additionally:

  • type is the same as imagerySet (compatibility with previous versions).
  • bingMapsKey is the same as key (for easy migration from digidem/leaflet-bing-layer)

See also options inherited from L.TileLayer (most useful: detectRetina, maxZoom, maxNativeZoom).

Events

load: Fired after metadata initialized.

Data: Event, extended with additional meta property.

Examples

bing.html

Addons

'Addons' are optional scripts adding some custom functionality to main class.

Should be loaded after Bing.js.

Addons can add own api (options, methods, etc), that is described in their source files' comments.

  • Bing.addon.applyMaxNativeZoom.js

    Metadata response has zoomMin/zoomMax properties, that currently (in most cases) are constant: 1/21. But in fact, imagery for 'Aerial*' and (deprecated) 'Road' sets may be absent at high zoom levels, depending on location.

    This addon is intended to find and apply real maximum available zoom (for current location) on layer add.