This article is to introduce you to a simple way of having a map on a web page. To do so, please add these two lines of HTML to your webpage:
<script src="//unpkg.com/[email protected]/dist/mapbox"></script> <x-mapbox center="Toronto, Canada" access-token="xxxyyy"></x-mapbox>
To switch between satellite mode and terrain mode, click a square icon on the top-right corner.
Mapbox uses access tokens to associate API requests with your account. This token will prevent the abusive use of the map, and it is also used to bill you when you exceed 50,000 requests per month.
An access token can be provided to
<x-mapbox> as an attribute:
access-token. Although it’s possible to provide an access token as an attribute, it’s highly recommended to provide it from JS code as
window.xKeys.mapbpx, which will be used for