Get Current Center Position Mapbox GL JS

MalloryMan picture MalloryMan · Feb 20, 2018 · Viewed 7.4k times · Source

Looking for a way to get the current coordinates of the center of a map using Mapbox GL JS the same way they do on Mapbox Studio (see below)

Mapbox Studio Screenshot

Thanks

Answer

Lucas Wojciechowski picture Lucas Wojciechowski · Feb 21, 2018

The Map#getCenter method returns the coordinates of the center of the map.