【发布时间】:2016-09-17 00:04:39
【问题描述】:
我正在为圣经营地制作游戏,并且想使用 Leaflet.js 制作地图。我正在使用 Mapbox 创建样式。我通过 csv 上传将罗马和耶路撒冷的坐标导入 Mapbox,它们在 preview 中渲染得很好。但是,它们在通过 Leaflet 加载时不会显示。见以下代码:
<head>
<title>Race to Rome</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css" />
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
</head>
<body>
<div id="mapid" style="height:500px;"></div>
<script src="http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js"></script>
<h1>Race to Rome</h1>
</body>
<script>
var mymap = L.map('mapid').setView(L.latLng(34,30), 5);
L.tileLayer('https://api.mapbox.com/styles/v1/wheelerj/cioerd0vf001yacm7rff4tj5h/tiles/{z}/{x}/{y}?access_token=pk.eyJ1Ijoid2hlZWxlcmoiLCJhIjoiY2lvZXJheTZrMDByNXVsbTNpZXp0c2VnbCJ9.T_jRdbo0CKUgZ2aiuA3kKA', {
maxZoom: 18,
attribution:
'Imagery ©<a href="http://mapbox.com">Mapbox</a>',
id: 'mapbox.streets'
}).addTo(mymap);
</script>
我需要做什么才能在 Leaflet 中包含这些标签?
【问题讨论】:
标签: javascript leaflet mapbox