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.

Source
Preview
index.tsx
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';

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

Refer the API for Navigation Lines feature.