Using mapbox layer on Openlayer v 2


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

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(
], {
attribution: “Tiles © MapBox“,
sphericalMercator: true,
wrapDateLine: true,
numZoomLevels: 8

Replace userid with your mapbox id

and token with your token for the map.