iserver是可以正常预览的 控制台没有报错啊 我是刚开始学 就是参考的教程里面的【创建一幅地图】代码
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>管网巡查</title> <!--leaflet官方文件--> <script type="text/javascript" src="js/leaflet/leaflet.js"></script> <link rel="stylesheet" href="js/leaflet/leaflet.css"> <!--iclient-leaflet--> <script type="text/javascript" src="js/leaflet/iclient-leaflet.js"></script> <link rel="stylesheet" href="js/leaflet/iclient-leaflet.min.css"> </head> <div> <div id="map" class="map-box-view"></div> </div> <script type="text/javascript" charset="utf-8"> var url ="https://iserver.supermap.io/iserver/services/map-world/rest/maps/World"; // 初始化地图信息 var map = L.map('map', { crs: L.CRS.NonEarthCRS({ bounds: L.bounds([48.4, -7668.25],[8958.85, -55.58]), origin: L.point(48.4,-55.58) }), center: [-4500, 4000], maxZoom: 18, zoom: 1 }); // 添加图层 L.supermap.tiledMapLayer(url, {noWrap: true}).addTo(map); </script> <style type="text/css"> .map-box-view { position: absolute; left: 0px; right: 0px; width: 800px; height: 500px; } </style> </html>
您可以参考我们的官网范例来修改您的代码https://iclient.supermap.io/examples/leaflet/editor.html#01_tiledMapLayer4326