Search results

Navigation Lines

Navigation lines are used to denote the path between the two locations. We can use this feature as flight or train or sea routes.

Following example shows rendering the path between two locations using latitudes and longitudes.

Yon can customize the navigation line color, dashArray, width and angle by modifying their default values in navigationLineSettings.

Refer the below code snippet to navigate line between two cities in World map. Import worldMap geo json data from WorldMap.ts file. Import the NavigationLine Module and Inject into the Maps using <Inject services={[NavigationLine]} /> tag. Provide two locations latitude and longitude values to navigationLineSettings.

import { world_map } from 'world-map.ts';
import * as React from "react";
import * as ReactDOM from "react-dom";
import { MapsComponent, LayersDirective, LayerDirective, Inject, NavigationLine, NavigationLinesDirective, NavigationLineDirective } from '@syncfusion/ej2-react-maps';

            <MapsComponent id="element">
                <Inject services={[NavigationLine]} />
                    <LayerDirective shapeData={world_map}>
                            <NavigationLineDirective visible={true} latitude={[37.6276571, -122.4276688]}
                                longitude={[-74.0060, -117.7418381]} color="black" angle={90} width={2} dashArray="4" />
document.getElementById("maps") as HTMLElement

Refer the API for Navigation Lines feature.