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>

posted @ 2016-11-18 10:58  米娜-火箭  阅读(4248)  评论(0编辑  收藏  举报