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 * as React from "react";
import * as ReactDOM from "react-dom";
import { MapsComponent, LayersDirective, LayerDirective } from '@syncfusion/ej2-react-maps';
ReactDOM.render(
<MapsComponent id="maps">
<LayersDirective>
<LayerDirective layerType='Bing'
bingMapType= 'AerialWithLabel'
key= '//bingmapkey'
/>
</LayersDirective>
</MapsComponent>,
document.getElementById("maps") as HTMLElement
);
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 * as React from "react";
import * as ReactDOM from "react-dom";
import { MapsComponent, LayersDirective, LayerDirective, Zoom, Inject } from '@syncfusion/ej2-react-maps';
ReactDOM.render(
<MapsComponent id="maps" zoomSettings= {{ zoomFactor: 4 }}
centerPosition = {{
latitude : 38.8951,
longitude : -77.0364
}}>
<Inject services={[Zoom]} />
<LayersDirective>
<LayerDirective layerType='Bing'
bingMapType= 'CanvasLight'
key= '// ...bingMapKey'
/>
</LayersDirective>
</MapsComponent>,
document.getElementById("maps") as HTMLElement
);
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 * as React from "react";
import * as ReactDOM from "react-dom";
import { MapsComponent, LayersDirective, LayerDirective, Zoom, Inject } from '@syncfusion/ej2-react-maps';
ReactDOM.render(
<MapsComponent id="maps" zoomSettings= {{
enable : true,
toolbars:[ "Zoom", "ZoomIn", "ZoomOut", "Pan", "Reset" ]}}>
<Inject services={[Zoom]} />
<LayersDirective>
<LayerDirective layerType='Bing'
key='// ...bingMapKey'
/>
</LayersDirective>
</MapsComponent>,
document.getElementById("maps") as HTMLElement
);
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 * as React from "react";
import * as ReactDOM from "react-dom";
import { MapsComponent, MarkersDirective, NavigationLineDirective, NavigationLinesDirective, MarkerDirective, LayersDirective, LayerDirective, Inject, Zoom, Marker, NavigationLine } from '@syncfusion/ej2-react-maps';
ReactDOM.render(
<MapsComponent id="maps" zoomSettings= {{
zoomFactor : 4
}}
centerPosition = {{
latitude: 29.394708,
longitude: -94.954653
}}>
<Inject services={[Zoom, Marker, NavigationLine]} />
<LayersDirective>
<LayerDirective layerType='OSM'>
<MarkersDirective>
<MarkerDirective visible={true}
height={25}
width={15}
dataSource={[
{
latitude: 34.060620,
longitude: -118.330491,
name: "California"
},
{
latitude: 40.724546,
longitude: -73.850344,
name: "New York"
}
]}
>
</MarkerDirective>
</MarkersDirective>
<NavigationLinesDirective>
<NavigationLineDirective visible={true}
latitude={[34.060620, 40.724546]}
longitude={[-118.330491,-73.850344]}
color="blue"
angle={90}
width={5} />
</NavigationLinesDirective>
</LayerDirective>
</LayersDirective>
</MapsComponent>,
document.getElementById("maps") as HTMLElement
);
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.
//tslint:disable
import { africa } from 'africa.ts';
import * as React from "react";
import * as ReactDOM from "react-dom";
import { MapsComponent, LayersDirective, LayerDirective } from '@syncfusion/ej2-react-maps';
ReactDOM.render(
<MapsComponent id="maps">
<LayersDirective>
<LayerDirective layerType='Bing' key='Enter your Bing map key here' />
<LayerDirective shapeData= {africa}
type= 'SubLayer'
shapeSettings= {{
fill: 'blue'
}}
/>
</LayersDirective>
</MapsComponent>,
document.getElementById("maps") as HTMLElement
);