I'm trying to integrate Bing Maps tiles into Leaflet. All of the plugins I've found to do this have been no help though since they have no info on their usage. I could write a script in PHP to recieve the X, Y and Z coordinates from Leaflet (just set the script as the tile server URL), but I'd need a way to convert them to a Quadkey. An answer for either would be acceptable. I do have a Bing Maps API key if that helps.
Option 1: Go to https://www.bing.com/maps, create the map you want, and then click Share. If you want control over basic parameters like size and imagery, click Customize and preview. This option will provide you with HTML that you can embed into your web page. Option 2: Create a Custom Map URL.
Each of the Bing Maps services uses a projected coordinate system called Mercator Auxiliary Sphere, which uses GCS_WGS_1984 as its geographic coordinate system.
Bing Maps allows you to add multiple destinations/stops to the route up to 25 stops. Plan a route and choose from options like walking, biking, public transport mode, or driving directions. You can also choose to print the routes you plan. Save the routes and destinations.
In November 2010 it was announced that Bing has granted the right to trace from their aerial imagery for the purpose of contributing content to OpenStreetMap.
GitHub user shramov's leaflet-plugins repository (linked to in the gist shared in Nicolas' answer) includes an example using a Bing tile layer, and has been fairly well maintained as far as I can tell. You'll need to include the Bing.js file along with the Leaflet JS and CSS:
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"></script>
<script src="Bing.js"></script>
<div id="map"></div>
<script type='text/javascript'>
var map = new L.Map('map', {center: new L.LatLng(67.6755, 33.936), zoom: 10 });
var bing = new L.BingLayer(YOUR_BING_API_KEY);
map.addLayer(bing);
</script>
You'll notice that the Bing tile layer defaults to Aerial imagery. If you open the Bing.js
file, you'll see on Line 4 that the type
property is set to 'Aerial'
. This can be changed to 'Road'
or 'AerialWithLabels'
for the corresponding Tile imagery.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With