Directions | Urbi Documentation
MapGL JS API

Directions

Directions functionality allows you to find an optimal route between multiple points (up to ten) and draw it on the map.

This plugin uses Directions API. To start using the plugin, get an API key for Directions API: see the instruction on obtaining API keys.

Next, you need to include the Directions plugin in your project. To do this, add the following line after the main MapGL script:

<script src="https://unpkg.com/@2gis/mapgl-directions@^2/dist/directions.js"></script>

Or you can install the needed package using npm:

npm install @2gis/mapgl-directions

This plugin calls Directions API under the hood to find a route. If you want, you can use your Directions API key to call the API directly instead of (or in addition to) using the plugin.

To start using the plugin, check the following resources: