Navigation Lines in Blazor Maps Component

8 Sep 20213 minutes to read

The navigation lines are used to denote the path between two locations. This feature can be used to draw flight or sea routes. Navigation lines are enabled by setting the Visible property of the MapsNavigationLine to true.

Customization

The following properties and classes are available in MapsNavigationLine to customize the navigation line of the Maps component.

  • Color - To apply the color for navigation lines in Maps.
  • DashArray - To define the pattern of dashes and gaps that is applied to the outline of the navigation lines.
  • Width - To customize the width of the navigation lines.
  • Angle - To customize the angle of the navigation lines.
  • MapsNavigationLineHighlightSettings - To customize the highlight settings of the navigation line.
  • MapsNavigationLineSelectionSettings - To customize the selection settings of the navigation line.

To navigate the line between two cities on the world map, Latitude and Longitude values are used to indicate the start and end points of navigation lines drawn on Maps.

@using Syncfusion.Blazor.Maps

<SfMaps>
    <MapsLayers>
        <MapsLayer ShapeData='new {dataOptions ="https://cdn.syncfusion.com/maps/map-data/world-map.json"}' TValue="string">
            <MapsNavigationLines>
                <MapsNavigationLine Visible="true" Color="black" Angle="90" Width="2" DashArray="4"
                                    Latitude="new double[]{ 40.7128, 36.7783 }" Longitude="new double[]{ -74.0060, -119.4179 }">
                </MapsNavigationLine>
            </MapsNavigationLines>
        </MapsLayer>
    </MapsLayers>
</SfMaps>

Maps with navigation lines

Enabling the arrows

To enable the arrow in the navigation line, set the ShowArrow property of MapsArrow to true. The following properties are available in MapsArrow to customize the arrow of the navigation lines.

  • Color - To apply the color for arrow of the navigation line.
  • Offset - To customize the offset position of the arrow of the navigation line.
  • Position - To customize the position of the arrow in navigation line. The possible values can be Start and End.
  • Size - To customize the size of the arrow in pixels.
@using Syncfusion.Blazor.Maps

<SfMaps>
    <MapsLayers>
        <MapsLayer ShapeData='new {dataOptions ="https://cdn.syncfusion.com/maps/map-data/world-map.json"}' TValue="string">
            <MapsNavigationLines>
                <MapsNavigationLine Visible="true" Color="blue" Angle="90" Width="2" DashArray="4"
                                    Latitude="new double[]{ 40.7128, 36.7783 }" Longitude="new double[]{ -74.0060, -119.4179 }">
                    @*  To set arrow for navigation line  *@
                    <MapsArrow ShowArrow="true" Color="blue"></MapsArrow>
                </MapsNavigationLine>
            </MapsNavigationLines>
        </MapsLayer>
    </MapsLayers>
</SfMaps>

Maps with navigation line arrow