Bing Maps is a online Maps provider, owned by Microsoft. As like OSM, it provide Maps tile images based on our requests and combines those images into a single one to display Maps area.
The Bing Maps can be rendered by setting the layerType
property as Bing and the key for the Bing Maps must be set in the key
property. The Bing Maps key can be obtained from here.
<template>
<div id="app">
<div class='wrapper'>
<ejs-maps :layers='layers'>
</ejs-maps>
</div>
</div>
</template>
<script>
import Vue from 'vue';
import { MapsPlugin, Marker } from '@syncfusion/ej2-vue-maps';
Vue.use(MapsPlugin);
export default {
data () {
return {
layers: [
{
layerType: 'Bing',
// Provide your bing map key here
key: '// ...bingMapKey'
}
]
}
}
}
</script>
<style>
.wrapper {
max-width: 400px;
margin: 0 auto;
}
</style>
Specifies Bing Maps key in the
key
property.
Bing Maps provides different types of Maps and it is supported in the Maps control.
To render the light version of the road Maps, set the bingMapType
to CanvasLight
as demonstrated in the following code sample.
<template>
<div id="app">
<div class='wrapper'>
<ejs-maps :centerPosition="centerPosition" :layers='layers'>
</ejs-maps>
</div>
</div>
</template>
<script>
import Vue from 'vue';
import { MapsPlugin} from '@syncfusion/ej2-vue-maps';
Vue.use(MapsPlugin);
export default {
data () {
return{
layers: [{
layerType: 'Bing',
bingMapType: 'CanvasLight',
key: '// ...bingMapKey',
}],
centerPosition: {
latitude: 38.8951,
longitude: -77.0364
}
}
},
}
</script>
<style>
.wrapper {
max-width: 400px;
margin: 0 auto;
}
</style>
Specify Bing Maps key in the
key
property.
Markers can be added to the layers of Bing Maps by setting the corresponding location’s coordinates of latitude and longitude using markerSettings
. Navigation lines can be added on top of an Bing Maps layer for highlighting a path among various places by setting the corresponding location’s coordinates of latitude and longitude in the navigationLineSettings
.
<template>
<div id="app">
<div class='wrapper'>
<ejs-maps :zoomSettings='zoomSettings' :layers='layers'>
</ejs-maps>
</div>
</div>
</template>
<script>
import Vue from 'vue';
import { MapsPlugin, Zoom } from '@syncfusion/ej2-vue-maps';
Vue.use(MapsPlugin);
export default {
data () {
return{
zoomSettings: {
enable: true,
toolBars: ["Zoom", "ZoomIn", "ZoomOut", "Pan", "Reset"]
},
layers: [{
layerType: 'Bing',
bingMapType: 'CanvasLight',
key: '// ...bingMapKey',
}]
}
},
provide: {
maps: [Zoom]
}
}
</script>
<style>
.wrapper {
max-width: 400px;
margin: 0 auto;
}
</style>
Markers can be added to the layers of Bing Maps by setting the corresponding location’s coordinates of latitude and longitude using markerSettings
. Navigation lines can be added on top of an Bing Maps layer for highlighting a path among various places by setting the corresponding location’s coordinates of latitude and longitude in the navigationLineSettings
.
<template>
<div id="app">
<div class='wrapper'>
<ejs-maps :layers='layers' :zoomSettings='zoomSettings'>
</ejs-maps>
</div>
</div>
</template>
<script>
import Vue from 'vue';
import { MapsPlugin, Zoom, Marker, NavigationLine } from '@syncfusion/ej2-vue-maps';
Vue.use(MapsPlugin);
export default {
data () {
return{
zoomSettings: {
enable: true
},
layers: [{
layerType: 'Bing',
bingMapType: 'CanvasLight',
key: '// ...bingMapKey',
markerSettings: [{
visible: true,
height: 25,
width: 15,
dataSource: [{
latitude: 34.060620,
longitude: -118.330491,
name: "California"
}]
},
{
visible: true,
height: 25,
width: 15,
dataSource: [{
latitude: 40.724546,
longitude: -73.850344,
name: "New York"
}]
}],
navigationLineSettings: [{
visible: true,
color: "blue",
angle: 0.1,
width: 5,
latitude: [34.060620, 40.724546],
longitude: [-118.330491,-73.850344]
}]
}]
}
},
provide: {
maps: [Zoom, Marker, NavigationLine]
}
}
</script>
<style>
.wrapper {
max-width: 400px;
margin: 0 auto;
}
</style>
Specify Bing Maps key in the
Key
property.
Any GeoJSON shape can be rendered as a sublayer on top of the Bing Maps layer for highlighting a particular continent or country in Bing Maps by adding another layer and specifying the type
property of Maps layer to SubLayer. The key for the Bing Maps must be set in the key
property.
<template>
<div id="app">
<div>
<ejs-maps :layers='layers'>
</ejs-maps>
</div>
</div>
</template>
<script>
import Vue from 'vue';
import { MapsPlugin } from '@syncfusion/ej2-vue-maps';
import { africa } from './africa.js';
Vue.use(MapsPlugin);
export default {
data () {
return {
layers: [{
layerType: 'Bing',
key: '// ...bingMapKey'
},
{
layerType: 'Geometry',
type: 'SubLayer',
shapeData: africa,
shapeSettings: {
fill: 'blue'
}
}
]
}
}
}
</script>