41. Mapbox satelite url token
1. url and token
- visit url http://www.mapbox.cn/mapbox-gl-js/example/satellite-map/ ,
- from the example,use F12 –> NetWork –> get the request url :
https://api.mapbox.com/v4/mapbox.satellite/14/13402/6763.webp?sku=1015TlSrLHf3s&access_token=pk.eyJ1IjoiZXhhbXBsZXMiLCJhIjoiY2p1dHRybDR5MGJuZjQzcGhrZ2doeGgwNyJ9.a-vxW4UaxOoUMWUTGnEArw - from the url above,get the token “pk.eyJ1IjoiZXhhbXBsZXMiLCJhIjoiY2p1dHRybDR5MGJuZjQzcGhrZ2doeGgwNyJ9.a-vxW4UaxOoUMWUTGnEArw”;
2. vector tile
https://docs.mapbox.com/api/maps/vector-tiles/
https://api.mapbox.com/v4/{tileset_id}/{zoom}/{x}/{y}.{format}
3. raster tile
https://api.mapbox.com/v4/{tileset_id}/{zoom}/{x}/{y}{@2x}.{format}
https://api.mapbox.com/v4/mapbox.satellite/1/0/0@2x.jpg90?access_token=YOUR_MAPBOX_ACCESS_TOKEN
4. template
https://docs.mapbox.com/api/maps/static-tiles/
https://api.mapbox.com/styles/v1/{username}/{style_id}/tiles/{tilesize}/{z}/{x}/{y}{@2x}
Retrieve raster tiles from a Mapbox Studio style.
The returned raster tile will be 512 pixels by 512 pixels by default.
If the queried tileset contains raster layers, the returned tile will be a JPEG.
If the queried tileset contains only vector layers, the returned tile will be a PNG.
- demo
5. mapbox demo
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>显示卫星地图</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v1.1.1/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v1.1.1/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
<div id='map'></div>
<script>
mapboxgl.accessToken = 'pk.eyJ1IjoiZXhhbXBsZXMiLCJhIjoiY2p1dHRybDR5MGJuZjQzcGhrZ2doeGgwNyJ9.a-vxW4UaxOoUMWUTGnEArw';
var map = new mapboxgl.Map({
container: 'map',
zoom: 9,
center: [137.9150899566626, 36.25956997955441],
style: 'mapbox://styles/mapbox/satellite-v9'
});
</script>
</body>
</html>