我的 TomTom 测试代码正在生成一张乱七八糟的地图:
为什么?!这是代码...
HTML:
<link rel="stylesheet" type="text/css" href="https://themepark.com/public/tomtom-jssdk-4.47.6/mapbox-gl-js/mapbox-gl.css">
<script src="https://themepark.com/public/tomtom-jssdk-4.47.6/tomtom.min.js"></script>
<div id='map_canvas'></div>
Javascript:
document.addEventListener( 'DOMContentLoaded', function( event ) {
var start_latitude = 50.720990653711, start_longitude = 18.89588147113, start_zoom=5;
// draw initial map
var map = tomtom.L.map( 'map_canvas', {
key: 'apikey',
source: 'raster',
basePath: 'http://themepark.com/public/tomtom-jssdk-4.47.6',
center: [start_latitude, start_longitude],
zoom: start_zoom,
} );
// if we can, try to locate user - this is a one-time action, and will update the map view
map.locate( {setView: true, maxZoom: 15} );
});
你可以在这个 codepen 上玩它:https ://codepen.io/pnoeric/pen/GevgBN?editors=1111