Skip to content

[Bug] map.flyTo centers on the incorrect spot when terrain is enabled.Β #2194

@erichcarson

Description

@erichcarson

Description

I recently tried to upgrade our version of react-map-gl to v7.0.25. During the upgrade I encountered a bug where map.flyTo goes to the incorrect location when map.setTerrain() has been called. Once at the incorrect location, if I manually move the map around, the Marker at that location stutters between the actual location and several incorrect locations.

Video with terrain and incorrect behavior:
https://github.com/visgl/react-map-gl/assets/127768277/fea86023-6558-457c-898a-eff71924333d

Video without terrain and correct behavior:
https://github.com/visgl/react-map-gl/assets/127768277/9f7d02b3-537a-49b7-a613-50fcfa17d97b

Expected Behavior

With terrain enabled, I would expect the same behavior as without terrain enabled. flyTo should center the map view on the actual location of the Marker taking into account the terrain information. This was working when using react-map-gl v6.1.10.

Steps to Reproduce

Behavior is reproducible at this sandbox, although you will need your own Mapbox API token.

Comment out the following line (line 21) to toggle the behavior:

map.setTerrain({ source: "mapbox-dem", exaggeration: 1.5 });

Environment

Logs

No error logs present in the console.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions