如何使用JavaScript制作Google的传单地图或卫星视图?

时间:2018-11-16 14:23:48

标签: javascript leaflet

我正在寻找一种解决方案,以创建一个框来在地图/卫星图层之间进行切换,就像Google Map一样,有人可以帮助创建这种切换样式(例如Google Map)吗? enter image description here

我在使用传单

renderBaseLayers: function (callback) {
            var self = this;

            var Esri_WorldImagery = L.tileLayer(
                'https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
                    attribution: '© Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community',
                    maxNativeZoom: 19,
                    maxZoom: 25,
                    opacity: 0.8,
                    type: 'satellite'
                });

            var World_Street_Map = L.tileLayer(
                'https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
                    attribution: '© Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community',
                    maxNativeZoom: 19,
                    maxZoom: 25,
                    opacity: 1,
                    type: 'street'
                });

            App.map.Markers = {};
            var layers = {
                'Satellite': Esri_WorldImagery.addTo(this.baseMap),
                'Map': World_Street_Map
            };  

            L.control.layers(layers , null, {position: "bottomright"}).addTo(this.baseMap);   

正在像本例中那样工作并显示结果。

https://leafletjs.com/examples/layers-control/

有人会建议我创建这种类似Google Map的开关样式吗?  谢谢。

0 个答案:

没有答案