你好,你可以在初始化加载地图的时候设置clipRegionEnabled:true(开启裁剪功能),设置裁剪区域clipRegion,就可以实现只加载裁剪区域内的地图数据。
参考代码如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title data-i18n="resources.title_tiledMapLayer4326"></title>
<script type="text/javascript" src="../js/include-web.js"></script>
</head>
<body style=" margin: 0;overflow: hidden;background: #fff;width: 100%;height:100%;position: absolute;top: 0;">
<div id="map" style="margin:0 auto;width: 100%;height: 100%"></div>
<script type="text/javascript" src="../../dist/leaflet/include-leaflet.js"></script>
<script type="text/javascript">
var host = window.isLocal ? window.server : "https://iserver.supermap.io";
var map, url = host + "/iserver/services/map-world/rest/maps/World";
map = L.map('map', {
crs: L.CRS.EPSG4326,
center: [39,116],
maxZoom: 18,
zoom: 8
});
var region = L.polygon([[39,116],[39,117],[40,117],[40,116]]).addTo(map);
new L.supermap.TiledMapLayer(url,{clipRegionEnabled:true,clipRegion:region}).addTo(map);
</script>
</body>
</html>