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.
L.bingLayer('[YOUR_BING_MAPS_KEY]').addTo(map);
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.
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 asimagerySet
(compatibility with previous versions).bingMapsKey
is the same askey
(for easy migration from digidem/leaflet-bing-layer)
See also options inherited from L.TileLayer
(most useful: detectRetina
, maxZoom
, maxNativeZoom
).
load
: Fired after metadata initialized.
Data: Event, extended with additional meta
property.
'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.