Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

leaflet-bing-layer

gmaclennan37kMIT3.3.1

Bing Maps Layer for Leaflet v1.0.0

leaflet, bing

readme

leaflet-bing-layer

Bing Maps Layer for Leaflet v1.0.0

L.TileLayer.Bing(options|BingMapsKey)

Create a new Bing Maps Layer. Depends on Promises which needs a polyfill for older browsers by adding this script to your html <head>:

<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=Promise"></script>

Parameters

parameter type description
options string|object A valid Bing Maps Key or an options object. options inherits from L.TileLayer options (e.g. you can use minZoom and opacity and etc)
options.bingMapsKey string A valid Bing Maps Key [required]
[options.imagerySet] string optional: Imagery Type [default=Aerial]
- Aerial - Aerial imagery
- AerialWithLabels - Aerial imagery with a road overlay
- AerialWithLabelsOnDemand - Aerial imagery with on-demand road overlay.
- CanvasDark - A dark version of the road maps.
- CanvasLight - A lighter version of the road maps which also has some of the details such as hill shading disabled.
- CanvasGray - A grayscale version of the road maps.
- Road - Roads without additional imagery. Uses the legacy static tile service.
- RoadOnDemand - Roads without additional imagery. Uses the dynamic tile service.
- OrdnanceSurvey - Ordnance Survey imagery. This imagery is visible only for the London area.
Not supported: Birdseye and BirdseyeWithLabels
[options.culture] string optional: Language for labels, see options [default=enUS_]
[options.style] string optional: Use a custom map style - only works with the AerialWithLabelsOnDemand and RoadOnDemand imagerySet options.

Other options are passed through to a Leaflet TileLayer

Methods

Method Returns Description
getMetaData(<LatLng> latlng, <Number> zoom) Promise Get the Bing Imagery metadata for a specific LatLng and zoom level. latLng or zoom are optional if the layer is attached to a map, they default to current map center and zoom. Returns a Promise that resolves to the metadata JSON from Bing

Example

var map = L.map('map').setView([51.505, -0.09], 13)
L.tileLayer.bing(MyBingMapsKey).addTo(map)

Live Example see index.html

License

MIT

changelog

Change Log

All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.

[3.3.1] - 2019-04-03

  • FIXED: options.culture correctly passed to Bing #27 [thanks @aparajita]

[3.3.0] - 2018-03-14

  • ADDED: options.style to use custom map styles
  • ADDED: AerialWithLabelsOnDemand imagery set
  • ADDED: minNativeZoom and maxNativeZoom options
  • FIXED: imageryProviders error #25

v3.2.0 - 2017-08-09

  • CHANGED: Use https requests
  • ADDED: Additional imagery sets (RoadOnDemand, CanvasLight, CanvasDark, CanvasGray, OrdnanceSurvey)

v3.1.0 - 2016-04-29

  • ADDED: Use https for Bing API requests.

v3.0.1 - 2015-12-13

  • FIXED: options.BingMapsKey backwards compatability
  • FIXED: options.bingMapsKey was not working for getMetaData
  • FIXED: catch errors (and log to console) for jsonp

v3.0.0 - 2015-12-08

  • FIXED: [BREAKING] Export factory function on L.tileLayer.bing not L.TileLayer.bing
  • CHANGED: BingMapsKey is now passed on options.bingMapsKey (options.BingMapsKey will still work, but for convention this should start with a lowercase character)
  • IMPROVED: Package with browserify and require dependencies
  • IMPROVED: Throws error if invalid imagerySet is passed as option
  • ADDED: getMetaData method

v2.0.2 - 2015-12-03

Initial release