Openlayers 3 的 imagelayer


<body>
    <div id="map"></div>
    <script>
        var extent = [0, 0, 1024, 968];//表示图片的尺寸
        var projection = new ol.proj.Projection({
            code: 'EPSG:3857',
            extent: extent
        });
        var imageLayer = new ol.layer.Image({
            source: new ol.source.ImageStatic({
                url: 'image/online_communities.png',
                projection: projection,
                imageExtent: extent
            })
        });
        var map = new ol.Map({  //初始化map
            target: 'map',
            layers: [
                imageLayer
            ],
            view: new ol.View({
                projection: projection,
                center: ol.extent.getCenter(extent),
                zoom: 2
            })
        });

    </script>
</body>


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM