我一直在尝试将传单地图添加到我的网页,但它没有正确呈现。当我加载页面时,它只显示为一个灰色框,在我开始缩小之前我什么也看不到。这可能是我找不到的基本东西。我添加了新西兰的坐标 long, lat 但它不起作用,所以我将顺序颠倒为 lat,只要其他人建议,这也不起作用。我还添加了一个标记来测试它会显示的位置,它应该在新西兰惠灵顿,但它似乎出现在海洋中间的某个地方。我也不确定我应该使用什么变焦我已经尝试了各种不同的数字,但它看起来总是一样的,直到我放大然后它离我的新西兰目标几英里之前什么都没有。JS:// initialize the map on the "map" div with a given center and zoomvar mymap = L.map('mapContainer').setView([40.9006, 174.8860], 5);var Esri_WorldGrayCanvas = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}', { attribution: 'Tiles © Esri — Esri, DeLorme, NAVTEQ', maxZoom: 18}).addTo(mymap);var marker = L.marker([41.2784, 174.7767]).addTo(mymap).bindPopup('The Beehive Wellington, house of Parliament')HTML: <link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css" integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ==" crossorigin=""/> <!--CSS STYLE SHEET REFERENCE--> <link rel="stylesheet" href="ass<!--SCRIPTS--> <script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script> <script src="https://unpkg.com/leaflet@1.5.1/dist/leaflet.js" integrity="sha512-GffPMF3RvMeYyc1LWMHtK8EbPv0iNZ8/oTtHPx9/cc2ILxQ+u905qIwdpULaqDkyBKgOaB57QTMg7ztg8Jm2Og==" crossorigin=""></script> <script type="text/javascript" src="https://cdn.emailjs.com/sdk/2.3.2/email.min.js"></script>当页面呈现时,我希望看到新西兰地图本身以及北岛底部惠灵顿的标记。当它渲染时,到目前为止我什么都看不到,我必须放大,但它离新西兰很近,惠灵顿的标记在太平洋的顶部。
1 回答

红糖糍粑
TA贡献1815条经验 获得超6个赞
您[lat, lng]在新西兰和Wellington.
它应该是
var mymap = L.map('mapContainer').setView([-40.9006, 174.8860], 5);
var marker = L.marker([-41.2784, 174.7767]).addTo(mymap)
添加回答
举报
0/150
提交
取消