Patrick Klitzke
Patrick Klitzke

Reputation: 1559

Mapbox Static API: fit markers to map

I was wondering if there is an easy way to fit all the markers one the created image of MapBox static api?

I mean something that does the same as

map.fitBounds()

in the non static version?

Upvotes: 3

Views: 1586

Answers (1)

geografa
geografa

Reputation: 701

Static Maps only have a center and image size but you can create a static image that fits your markers' extent with the geo-viewport plugin: https://www.mapbox.com/mapbox.js/example/v1.0.0/static-map-from-geojson-with-geo-viewport/

Upvotes: 1

Related Questions