Notes on using the v4 Mapbox API

This commit is contained in:
Tim Schaub
2016-05-10 11:57:43 -06:00
parent 94b8c853a7
commit 476191b0d0
3 changed files with 24 additions and 3 deletions
+5 -3
View File
@@ -5,15 +5,17 @@ goog.require('ol.layer.Tile');
goog.require('ol.source.TileJSON');
goog.require('ol.source.TileUTFGrid');
var key = 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg';
var mapLayer = new ol.layer.Tile({
source: new ol.source.TileJSON({
url: 'http://api.tiles.mapbox.com/v3/mapbox.geography-class.json'
url: 'http://api.tiles.mapbox.com/v4/mapbox.geography-class.json?access_token=' + key
})
});
var gridSource = new ol.source.TileUTFGrid({
jsonp: true, // for v4 and above, leave this option off
url: 'http://api.tiles.mapbox.com/v3/mapbox.geography-class.json'
url: 'http://api.tiles.mapbox.com/v4/mapbox.geography-class.json?access_token=' + key
});
var gridLayer = new ol.layer.Tile({source: gridSource});