Blazor Geographic Symbol Map
In Blazor map component, you can use the IgbGeographicSymbolSeries
to display geo-spatial data using points or markers in a geographic context. This type of geographic series is often used to render a collection of geographic locations such as cities, airports, earthquakes, or points of interests.
Blazor Geographic Symbol Map Example
Data Requirements
Similarly to other types of geographic series in the map component, the IgbGeographicSymbolSeries
has the DataSource
property which can be bound to an array of objects. In addition, each data item in this object must have two numeric data columns that store a geographic location (longitude and latitude). These data columns are then mapped to the LatitudeMemberPath
and LongitudeMemberPath
properties. The IgbGeographicSymbolSeries
uses values of these mapped data columns to plot symbol elements in the geographic map component.
Code Snippet
The following code shows how to bind the IgbGeographicSymbolSeries
to locations of cities loaded from a shape file using the IgbShapeDataSource
.
@using IgniteUI.Blazor.Controls
<IgbGeographicMap Height="100%" Width="100%" Zoomable="true">
<IgbGeographicSymbolSeries DataSource="Cities"
MarkerType="MarkerType.Circle"
LatitudeMemberPath="Lat"
LongitudeMemberPath="Lon"
MarkerBrush="White"
MarkerOutline="Gray" />
<IgbGeographicSymbolSeries DataSource="Capitals"
MarkerType="MarkerType.Circle"
LatitudeMemberPath="Lat"
LongitudeMemberPath="Lon"
MarkerBrush="White"
MarkerOutline="rgb(32, 146, 252)" />
</IgbGeographicMap>
@code {
private List<WorldCity> Cities;
private List<WorldCity> Capitals;
protected override void OnInitialized()
{
this.Cities = WorldLocations.GetCities();
this.Capitals = WorldLocations.GetCapitals();
}
}