为什么在使用基于ArcGIS的服务(例如, https://uneplivemapservices.unep.org/arcgis/rest/services/UNBASEMAP_Tiled/MapServer
var { LMap, LTileLayer, LMarker } = Vue2Leaflet;
new Vue({
el: '#app',
components: { LMap, LTileLayer, LMarker },
data() {
return {
zoom:13,
center: L.latLng(47.413220, -1.219482),
//URL BELOW NOT WORKING
url:'https://uneplivemapservices.unep.org/arcgis/rest/services/UNBASEMAP_Tiled/MapServer', //NOT WORKING
//URL BELOW WORKING
//url:'http://{s}.tile.osm.org/{z}/{x}/{y}.png', //WORKING
attribution:'© <a href="http://osm.org /copyright">OpenStreetMap</a> contributors',
marker: L.latLng(47.413220, -1.219482),
}
}
});
答案 0 :(得分:1)
我能够找到一种解决方法,如小提琴http://jsfiddle.net/oskgfxpz/
所示。HTML
<l-map style="height:400px;background-color: rgb(123, 173, 223);" ref="map" :zoom=2 :center="[0.02, 36.9]">
<l-marker :key="2" :lat-lng="[0.02, 36.9]">
<l-popup :content="'Example tooltip'"></l-popup>
</l-marker>
</l-map>
JAVASCRIPT
var { LMap, LTileLayer, LGeoJson, LMarker, LPopup } = Vue2Leaflet;
new Vue({
el: '#app',
components: {
LMap,
LTileLayer,
LGeoJson,
LMarker,
LPopup
},
data () {
return {
}
},
mounted() {
const UNbaseMap = L.esri.tiledMapLayer({
url: 'https://uneplivemapservices.unep.org/arcgis/rest/services/UNBASEMAP_Tiled/MapServer',
maxZoom: 5,
minZoom: 2
});
this.$refs.map.mapObject.addLayer(UNbaseMap);
}
});
答案 1 :(得分:0)
正如@ghyps指出的那样,有一个选项可以传递/{z}/{x}/{y}
;从文档中:
var { LMap, LTileLayer, LMarker } = Vue2Leaflet;
new Vue({
el: '#app',
components: { LMap, LTileLayer, LMarker },
data() {
return {
zoom:5,
center: L.latLng(47.413220, -1.219482),
url:'https://uneplivemapservices.unep.org/arcgis/rest/services/UNBASEMAP_Tiled/MapServer/tile/{z}/{y}/{x}', //NOT WORKING
//url:'http://{s}.tile.osm.org/{z}/{x}/{y}.png', //WORKING
attribution:'© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors',
marker: L.latLng(47.413220, -1.219482),
}
}
});
但是显然缩放级别> 5的图块不可用