Download
We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

Tutorial: Adding OpenStreetMap to your website!

#1911
Avatar photo[anonymous]

Zooming in a particular location

Add the option center to the map object.

`var map = new mapboxgl.Map({
container: ‘openstreetmap’,
style: ‘mapbox://styles/mapbox/streets-v11’,
center: [longitude, latitude],
zoom: 15
});`

You can find the longitude and latitude of your location by using the Mapbox Playground.

You can find the Mapbox Playground here:

https://docs.mapbox.com/search-playground

Search for your location and click once on the button Toggle JSON panel (in the top right of the website).