Skip to content

Overview

Map Basics

Use flyTo to smoothly interpolate between locations.

Fly to a location

Use flyTo to smoothly interpolate between locations.

Use the jumpTo function to showcase multiple locations.

Jump to a series of locations

Use the jumpTo function to showcase multiple locations.

Initialize a map with pitch and bearing camera options.

Set pitch and bearing

Initialize a map with pitch and bearing camera options.

Use flyTo with flyOptions to slowly zoom to a location.

Slowly fly to a location

Use flyTo with flyOptions to slowly zoom to a location.

Animate a line by updating a GeoJSON source on each frame.

Animate a line

Animate a line by updating a GeoJSON source on each frame.

Animate the position of a point by updating a GeoJSON source on each frame.

Animate a point

Animate the position of a point by updating a GeoJSON source on each frame.

Use Turf to smoothly animate a point along the distance of a line.

Animate a point along a route

Use Turf to smoothly animate a point along the distance of a line.

Animate the map camera around a point.

Animate map camera around a point

Animate the map camera around a point.

Customize camera animations using AnimationOptions.

Customize camera animations

Customize camera animations using AnimationOptions.

Customize the constrain callback of the map transform. For example, to allow users to underzoom and overpan the bounds.

Customize the map transform constrain

Customize the constrain callback of the map transform. For example, to allow users to underzoom and overpan the bounds.

Fit the map to a specific area, regardless of the pixel size of the map.

Fit a map to a bounding box

Fit the map to a specific area, regardless of the pixel size of the map.

Get the bounds of a LineString.

Fit to the bounds of a LineString

Get the bounds of a LineString.

Scroll down through the story and the map will fly to the chapter's location.

Fly to a location based on scroll position

Scroll down through the story and the map will fly to the chapter's location.

Keep the viewport state in the url with hash routing.

Hash routing

Keep the viewport state in the url with hash routing.

Modify how Level of Detail behaves at high pitch angles.

Level of Detail Control

Modify how Level of Detail behaves at high pitch angles.

Offset the center or vanishing point of the map to reduce distortion when floating elements are displayed over the map.

Offset the vanishing point using padding

Offset the center or vanishing point of the map to reduce distortion when floating elements are displayed over the map.

Toggle between rendering a single world and multiple copies of the world using setRenderWorldCopies.

Render world copies

Toggle between rendering a single world and multiple copies of the world using setRenderWorldCopies.

Prevent a map from being panned to a different place by setting maxBounds.

Restrict map panning to an area

Prevent a map from being panned to a different place by setting maxBounds.

Set the center point above ground level.

Set center point above ground

Set the center point above ground level.

Sources

Layers

Annotations & Labels

Interactivity & Extensions