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.
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-container',
template:
`<ejs-maps id='rn-container' style="display:block">
<e-layers>
<e-layer [layerType] = 'layerType' [bingMapType] = 'bingMapType' [key]='key'></e-layer>
</e-layers>
</ejs-maps>`
})
export class AppComponent implements OnInit {
public layerType: string;
public bingMapType: string;
public key: string;
ngOnInit(): void {
this.layerType = 'Bing';
this.bingMapType = 'AerialWithLabel';
this.key = '//..bingmapkey';
}
}
Specify 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.
import { Component, OnInit} from '@angular/core';
@Component({
selector: 'app-container',
template:
`<ejs-maps id='rn-container' style="display:block">
<e-layers>
<e-layer [layerType] = 'layerType' [bingMapType] = 'bingMapType' [key]='key'></e-layer>
</e-layers>
</ejs-maps>`
})
export class AppComponent implements OnInit {
public layerType: string;
public bingMapType: string;
public key: string;
ngOnInit(): void {
this.layerType = 'Bing';
this.bingMapType = 'CanvasLight';
this.key = '//..bingmapkey';
}
}
Specify Bing Maps key in the
key
property.
Bing Maps layer can be zoomed and panned. Zooming helps to get a closer look at a particular area on a Maps for in-depth analysis. Panning helps to move a Maps around to focus the targeted area.
import { Component, OnInit } from '@angular/core';
import { Maps, Zoom } from '@syncfusion/ej2-angular-maps';
Maps.Inject(Zoom);
@Component({
selector: 'app-container',
template: `
<ejs-maps id="rn-container" [zoomSettings]="zoomSettings" style="display:block">
<e-layers>
<e-layer [layerType]="layerType" [key]="key" [bingMapType]="bingMapType"></e-layer>
</e-layers>
</ejs-maps>
`
})
export class AppComponent implements OnInit {
public layerType: string;
public zoomSettings: object;
public bingMapType: string;
public key: string;
ngOnInit(): void {
this.layerType = 'Bing';
this.bingMapType = 'CanvasLight';
this.key = '//..bingmapkey';
this.zoomSettings = {
enable: true
};
}
}
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
.
import { Component, OnInit } from '@angular/core';
import { Maps, Zoom, Marker, NavigationLine } from '@syncfusion/ej2-angular-maps';
Maps.Inject(Zoom, Marker, NavigationLine);
@Component({
selector: 'app-container',
template: `
<ejs-maps id="rn-container" style="display:block" [zoomSettings]="zoomSettings" [centerPosition]="centerPosition">
<e-layers>
<e-layer [layerType]="layerType" [bingMapType]="bingMapType" [key]="key" [markerSettings]="markerSettings" [navigationLineSettings]="navigationLineSettings"></e-layer>
</e-layers>
</ejs-maps>
`
})
export class AppComponent implements OnInit {
public layerType: string;
public bingMapType: string;
public key: string;
public zoomSettings: object;
public centerPosition: object;
public markerSettings: object;
public navigationLineSettings: object;
ngOnInit(): void {
this.layerType = 'Bing';
this.bingMapType = 'CanvasLight';
this.key = '//..bingmapkey';
this.zoomSettings = {
zoomFactor: 4
};
this.centerPosition = {
latitude: 29.394708,
longitude: -94.954653
};
this.markerSettings = [
{
visible: true,
height: 25,
width: 15,
dataSource: [
{
latitude: 34.06062,
longitude: -118.330491,
name: 'California'
},
{
latitude: 40.724546,
longitude: -73.850344,
name: 'New York'
}
]
}
];
this.navigationLineSettings = [
{
visible: true,
color: 'blue',
width: 5,
angle: 0.1,
latitude: [34.06062, 40.724546],
longitude: [-118.330491, -73.850344]
}];
}
}
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.
import { Component, ViewEncapsulation, ViewChild } from '@angular/core';
import { Maps } from '@syncfusion/ej2-angular-maps';
import { africa_continent } from 'africa-continent.ts';
@Component({
selector: 'app-container',
template:
`<ejs-maps id='rn-container'>
<e-layers>
<e-layer [layerType]= 'layerType' [key] ='key'></e-layer>
<e-layer [shapeData]= 'shapeData' [type] ='Sublayer' [shapeSettings]='shapeSettings'></e-layer>
</e-layers>
</ejs-maps>`
})
export class AppComponent implements OnInit {
public layerType: string;
public key: string;
public shapeData: object;
public shapeSettings: object;
ngOnInit(): void {
this.layerType = "Bing";
this.key= "../bingmapkey";
this.shapeData = africa_continent;
this.shapeSettings = {
fill: 'blue'
}
}
}