woowoowoo
woowoowoo

Reputation: 185

Add a scale bar to a map

Is it possible to add a scale bar to a map?

I was hoping for something 'built in' like:

map.addControl(new mapboxgl.Scale({position: 'bottom-right'}));

Seems it was possible via a leaflet control in the classic js

L.control.scale().addTo(map);

Upvotes: 8

Views: 10955

Answers (1)

mollymerp
mollymerp

Reputation: 1602

map.addControl(new mapboxgl.ScaleControl({position: 'bottom-right'}));

The documentation can be found here

  • disclaimer - I work at Mapbox

Upvotes: 14

Related Questions