zoukankan      html  css  js  c++  java
  • leaflet叠加图片图层

    <!DOCTYPE html>
    <html>
    <head>
    
        <title>Layers Control Tutorial - Leaflet</title>
    
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    
        <link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" />
    
        <link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ==" crossorigin=""/>
        <script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js" integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew==" crossorigin=""></script>
    
    
        <style>
            html, body {
                height: 100%;
                margin: 0;
            }
            #map {
                width: 1000px;
                height: 700px;
            }
        </style>
    
    
    </head>
    <body>
    
    <div id='map'></div>
    
    <script>
    
        var grayscaleLayer= L.tileLayer('http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineCommunity/MapServer/tile/{z}/{y}/{x}', {id: 'map11',maxZoom: 16,minZoom: 4});
    
        var map = L.map('map', {
            minZoom: 5,
            maxZoom: 12,
            center: [39.73, -104.99],
            zoom: 10,
            zoomDelta: 0.5,//点击+-按钮的放缩刻度尺度,默认值1
            zoomSnap: 0.5,//地图能放缩的zoom的最小刻度尺度,默认值1
            fullscreenControl: false,//全屏控件,不显示
            zoomControl: false,//放大缩小控件,不显示
            attributionControl: false//右下角属性控件,不显示
        });
        map.addLayer(grayscaleLayer);
    
    
        var imageBounds = [[0, 50], [61.148, 180]];//图片的经纬度范围,西南角点,东北角点(纬度、经度)
        var imageUrl='url';//图片的地址
        var imageLayer =L.imageOverlay(imageUrl, imageBounds,{opacity:0.8});//opacity是透明度
        map.addLayer(imageLayer);
    
        //如果imageLayer已经创建,后续只需要切换url即可
        if(imageLayer!=null)
        {
            imageLayer.setUrl(imageUrl);
        }
    </script>
    
    
    
    </body>
    </html>
  • 相关阅读:
    亲和数
    改革春风吹满地
    处理选中图片
    项目架构(结构)搭建:主流结构(UITabBarController + 导航控制器)
    iOS应用启动main函数
    LaunchScreen&LaunchImage
    颜色常识
    折半查找法(二分法)
    冒泡排序
    多用户登录
  • 原文地址:https://www.cnblogs.com/tiandi/p/12321334.html
Copyright © 2011-2022 走看看