Directions | Urbi Documentation

Directions

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

In order to use this functionality, you first need to obtain a Directions API key. You can do so by filling in the form at dev.2gis.com.

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.

More...