1、继承L.TileLayer的新类arcgisTiledLayer
L.TileLayer.ArcgisTiledLayer = L.TileLayer.extend({ initialize: function (url, options) { L.TileLayer.prototype.initialize.call(this, url + "/tile/{z}/{y}/{x}", options); } }); L.tileLayer.arcgisTiledLayer = function (url, options) { return new L.TileLayer.ArcgisTiledLayer(url, options); };
2、前端调用方法
var layer1 = L.tileLayer.arcgisTiledLayer(‘http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineCommunity/MapServer‘, { maxZoom: 12, minZoom: 4 }); var map = L.map("map", { center: [31.59, 120.29], zoom: 5, layers: [layer1], zoomControl: false });
原文地址:https://www.cnblogs.com/tiandi/p/9734488.html
时间: 2024-10-14 05:20:38