我需要的不是卫星传单的基本视图(这是世界地图),而是卫星视图,但是我仍然需要能够在它们之间切换?这是怎么工作的,有人可以向我解释吗?

安装的模块:

https://www.drupal.org/project/gmap

https://www.drupal.org/project/leaflet_more_maps

最佳答案

不使用任何外部插件:

gpxpod.map = new L.Map('map', {
    zoomControl: true
});

var osmUrl = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
var osmAttribution = 'Map data &copy; 2013 <a href="http://openstreetmap'+
'.org">OpenStreetMap</a> contributors';
var osm = new L.TileLayer(osmUrl, {maxZoom: 18, attribution: osmAttribution});

var esriAerialUrl = 'https://server.arcgisonline.com/ArcGIS/rest/services'+
'/World_Imagery/MapServer/tile/{z}/{y}/{x}';
var esriAerialAttrib = 'Tiles &copy; Esri &mdash; Source: Esri, i-cubed, '+
'USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the'+
' GIS User Community';
var esriAerial = new L.TileLayer(esriAerialUrl,
    {maxZoom: 18, attribution: esriAerialAttrib});

var gUrl = 'http://mt0.google.com/vt/lyrs=s&x={x}&y={y}&z={z}';
var gAttribution = 'google';
var googlesat = new L.TileLayer(gUrl, {maxZoom: 18, attribution: gAttribution});

var baseLayers = {
    'OpenStreetMap': osm,
    'ESRI Aerial': esriAerial,
    'Google map sat': googlesat
}

L.control.layers(baseLayers, {}).addTo(map);


这段代码添加了一个标准控件,可在图块提供程序层之间切换。它包括两个卫星图块提供商。

更多信息:http://leafletjs.com/reference-1.0.3.html#control-layers

关于javascript - 传单使用卫星 View ,Drupal 8?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/43252401/

10-10 14:58