Using mapbox layer on Openlayer v 2

Standard

Now, Tile maps is a useful for simple and fast data sharing.

Mapbox is a service that you can upload your preset MTiles or your raw data and make the tile server ready on their service.

Cliend and API is also ready in mapbox.com

However, many people ( like me still prefer OpenLayers API) following is a code you can add TileMap from Mapbox to openlayer

var mylayer = new OpenLayers.Layer.XYZ(
“mymap”,
[
"https://a.tiles.mapbox.com/v4/userid/${z}/${x}/${y}.png?access_token=token"
], {
attribution: “Tiles © MapBox“,
sphericalMercator: true,
wrapDateLine: true,
numZoomLevels: 8
}
);

Replace userid with your mapbox id

and token with your token for the map.