美文网首页
openlayer5.0 加载高德瓦片

openlayer5.0 加载高德瓦片

作者: 青色沙丘 | 来源:发表于2019-07-23 12:54 被阅读0次

1.网上有很多openlayer加载其他xyz瓦片的。但是发现使用的投影坐标有问题。弄了半天搞定了一个。

this.map = new ol.Map({
                target: 'map',
                layers:[new ol.layer.Tile({
                // visible: true,
                source: new ol.source.XYZ({
                    url: 'http://webrd01.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scale=1&style=8',
                    // projection: 'EPSG:4326' 特此注释掉。投影问题

                })
            })],
                controls: ol.control.defaults({
                    attribution: false,
                    zoom: false
                }),
                view: new ol.View({
                    center: [116.397428, 39.90923],
                    projection: 'EPSG:4326',
                    zoom: 14
                })
            });

相关文章

网友评论

      本文标题:openlayer5.0 加载高德瓦片

      本文链接:https://www.haomeiwen.com/subject/ycyolctx.html