1 Star 20 Fork 7

xiaoFsu / MapBox

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
index.html 1.62 KB
一键复制 编辑 原始数据 按行查看 历史
xiaofsu 提交于 2019-10-24 09:52 . 更新文件
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<!--本地加载的js及css文件-->
<script src='http://localhost/js/mapbox-gl-1.4.1.js'></script>
<link href='http://localhost/css/mapbox-gl-1.4.1.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>
var map = new mapboxgl.Map({
container: 'map', // container id
style: {
"version": 8,
"name": "Mapbox Streets",
"sprite": "http://localhost/images/sprite",//图标
"glyphs": "http://localhost/font/{fontstack}/{range}.pbf",//字体文件
"sources": {
"osm-tiles": {
"type": "raster",
'tiles': [
//"http://mt2.google.cn/vt/lyrs=s@167000000&hl=zh-CN&gl=cn&x={x}&y={y}&z={z}"//谷歌路径
"http://192.168.1.26:9999/data/map/{z}/{x}/{y}.png"//本地路径
],
'tileSize': 256
},
},
"layers": [{
"id": "simple-tiles",
"type": "raster",
"source": "osm-tiles",
"minzoom": 0,
"maxzoom": 22
}]
}, //hosted style id
center: [121, 31], // starting position
zoom: 0 // starting zoom
});
</script>
</body>
</html>
CSS
1
https://gitee.com/xiaoFsu/MapBox.git
git@gitee.com:xiaoFsu/MapBox.git
xiaoFsu
MapBox
MapBox
master

搜索帮助