Search results

Bing Maps

Bing maps is a map of the entire World owned by Microsoft. As like OSM, it provides map tile images based on our requests and combines those images into a single one to display the map area.

Add Bing Maps

One of the most important features in Blazor Maps component is the built-in online map provider support. By using this feature, you can render Bing maps in the maps component. This provides the ability to visualize satellite, aerial, and street maps without using any external shape files.

You can enable this feature by setting LayerType to “ShapeLayerType.Bing”.

@using Syncfusion.EJ2.Blazor.Maps

<EjsMaps>
    <MapsLayers>
        <MapsLayer LayerType="ShapeLayerType.Bing" Key=""></MapsLayer>
    </MapsLayers>
</EjsMaps>

Specify Bing map key in the Key property.

Bing map

Types of Bing maps

  • Aerial - Displays satellite images to highlight roads and major landmarks for easy identification.
  • AerialWithLabel - Displays aerial map with labels for the continent, country, ocean, etc.
  • Road - Displays the default map view of roads, buildings, and geography.
  • CanvasDark - Displays dark version of the road maps.
  • CanvasLight - Displays light version of the road maps.
  • CanvasGray - Displays grayscale version of the road maps.

To render the light version of the road maps, set the BingMapType to CanvasLight as demonstrated in the following code sample.

@using Syncfusion.EJ2.Blazor.Maps

<EjsMaps>
    <MapsLayers>
        <MapsLayer LayerType="ShapeLayerType.Bing" BingMapType="BingMapType.CanvasLight" Key="">
        </MapsLayer>
    </MapsLayers>
    @* Additionally map has been zoomed based on the center position *@
    <MapsZoomSettings ZoomFactor="12"></MapsZoomSettings>
    <MapsCenterPosition Latitude="38.8951" Longitude="-77.0364"></MapsCenterPosition>
</EjsMaps>

Specify Bing maps key in the Key property.

Bing map with light version of road maps

Zooming and panning

You can zoom and pan the Bing maps layer. Zooming helps you get a closer look at a particular area on a map for in-depth analysis. Panning helps you to move a map around to focus the targeted area.

@using Syncfusion.EJ2.Blazor.Maps

<EjsMaps>
    @* To zoom and pan using toolbar *@
    <MapsZoomSettings Enable="true"
                      Toolbars='new string[]{"Zoom", "ZoomIn", "ZoomOut", "Pan", "Reset" }'>
    </MapsZoomSettings>
    <MapsLayers>
        <MapsLayer LayerType="ShapeLayerType.Bing" Key=""></MapsLayer>
    </MapsLayers>
</EjsMaps>

Specify Bing map key in the Key property.

Bing Maps with zooming

Adding markers and navigation line

Markers can be added to the layers of Bing maps by setting the corresponding location’s coordinates of latitude and longitude using MapsMarker property. You can add navigation lines 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 MapsNavigationLine property.

@using Syncfusion.EJ2.Blazor.Maps

<EjsMaps>
    <MapsZoomSettings ZoomFactor="4"></MapsZoomSettings>
    <MapsCenterPosition Latitude="29.394708" Longitude="-94.954653"></MapsCenterPosition>
    <MapsLayers>
        <MapsLayer LayerType="ShapeLayerType.Bing"
                   BingMapType="BingMapType.CanvasLight"
                   Key="">
            @* Add markers *@
            <MapsMarkerSettings>
                <MapsMarker Visible="true"
                            Height="25"
                            Width="15"
                            DataSource="@cities">
                </MapsMarker>
            </MapsMarkerSettings>
            @* Add navigation line *@
            <MapsNavigationLines>
                <MapsNavigationLine Visible="true"
                                    Color="blue"
                                    Angle="0.1"
                                    Latitude="new double[]{34.060620, 40.724546}"
                                    Longitude="new double[]{-118.330491,-73.850344}">
                </MapsNavigationLine>
            </MapsNavigationLines>
        </MapsLayer>
    </MapsLayers>
</EjsMaps>

@code{
    public class City
    {
        public double Latitude;
        public double Longitude;
        public string Name;
    }
    private List<City> cities = new List<City> {
        new City { Latitude = 34.060620, Longitude = -118.330491,  Name="California" },
        new City{ Latitude = 40.724546, Longitude = -73.850344,  Name="New York"}
    };
}

Specify Bing map key in the Key property.

Bing Maps with markers and navigation line

Sublayer

You can render any GeoJSON shape as a sublayer on top of an Bing maps layer for highlighting a particular continent or country in Bing maps by adding another layer and specifying the type to SubLayer.

Refer to section to learn how to add a sublayer in Bing maps

Key

The Bing maps key is provided as input to this key property. The Bing Maps key can be obtained from Bing Maps.