Skip to content

Fly To Coordinates

In this guide you will learn how to render an interactive map, and fly to a destination specified by latitude and longitude coordinates.


First, get an API key token, see the Getting Started guide.

Download the Maps & Navigation SDK for Android archive file

Download the FlyToCoordinates project archive file or clone the project with Git

See the Configure Android Example guide.

Run the example

In Android Studio, from the File menu, select Sync Project with Gradle Files

An android device should be connected via USB cable.
Press SHIFT+F10 to compile, install and run the example on the android device.

Fly to coordinates example Android screenshot

This example flies to the destination specified by the given latitude, longitude point coordinates.
Displays an interactive map which is fully 3D, supporting pan, pinch-zoom, rotate and tilt.

How it works

Android example screenshot

You can open the MainActivity.kt file and edit the coordinates of the destination (latitude, longitude) as shown in the code below, and run the app again to fly to a different destination.

1// Kotlin code
2mapSurface.onScreenCreated = { screen ->
3  // Defines an action that should be done after the screen is created.
4    val coordinates = Coordinates(48.86141, 2.33420)//Musee du Louvre, Paris
5  flyTo(coordinates)

For example, you can change the Coordinates to (45.43597, 12.33060) to fly to Venice instead, and then run the example again.

1private fun flyTo(coordinates: Coordinates)
3  val animation = Animation()
4  animation.setType(EAnimation.AnimationLinear)
5  // Center the map on a specific set of coordinates using the provided animation.
6  mainMapView?.centerOnCoordinates(coordinates, -1, Xy(), animation)

The mainMapView?.centerOnCoordinates(coordinates, -1, Xy(), animation) function is used to fly to the specified coordinates.

Android Examples

Maps SDK for Android Examples can be downloaded or cloned with Git