Mapbox:无法通过map_id

时间:2017-02-20 15:00:43

标签: mapbox

当我尝试从地图加载标记时,我收到以下错误消息:

{"message":"Markers do not exist"}

这是我的代码:

<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>BoxMap</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />


<script src='https://api.mapbox.com/mapbox.js/v3.0.1/mapbox.js'></script>
<link href='https://api.mapbox.com/mapbox.js/v3.0.1/mapbox.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>
L.mapbox.accessToken = 'this_is_my_token';
var map = L.mapbox.map('map')
    .setView([40.447, -5.625], 2);

L.mapbox.styleLayer('mapbox://styles/this_is_my_style').addTo(map);

L.mapbox.featureLayer().loadID('this_is_my_map_id').addTo(map);

</script>
</body>
</html>

PS:当我尝试在mapbox网站上放置给定示例中的map_id时,它可以正常工作!示例:examples.map-h61e8o8e

由于

0 个答案:

没有答案