@@ -13,7 +13,7 @@ import { Util } from '../core/Util';
1313 * @classdesc 百度地图图层源。
1414 * @modulecategory Mapping
1515 * @param {Object } opt_options - 参数。
16- * @param {string } [opt_options.url='https://online3.map .bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles={styles}&udt=20170408'] - 服务地址。
16+ * @param {string } [opt_options.url='https://maponline{num} .bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles={styles}&udt=20170408'] - 服务地址。
1717 * @param {string } [opt_options.tileProxy] - 代理地址。
1818 * @param {boolean } [hidpi = false] - 是否使用高分辨率地图。
1919 * @extends {ol.source.TileImage }
@@ -31,7 +31,7 @@ export class BaiduMap extends TileImage {
3131 var url =
3232 options . url !== undefined
3333 ? options . url
34- : 'https://online3.map .bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles={styles}&udt=20170408' ;
34+ : 'https://maponline{num} .bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles={styles}&udt=20170408' ;
3535 var hidpi =
3636 options . hidpi || ( window . devicePixelRatio || window . screen . deviceXDPI / window . screen . logicalXDPI ) > 1 ;
3737 url = url . replace ( '{styles}' , hidpi ? 'ph' : 'pl' ) ;
@@ -58,6 +58,7 @@ export class BaiduMap extends TileImage {
5858 // eslint-disable-next-line no-unused-vars
5959 function tileUrlFunction ( tileCoord , pixelRatio , projection ) {
6060 var tempUrl = url
61+ . replace ( '{num}' , Math . abs ( ( tileCoord [ 1 ] + tileCoord [ 2 ] ) % 4 ) )
6162 . replace ( '{z}' , tileCoord [ 0 ] . toString ( ) )
6263 . replace ( '{x}' , tileCoord [ 1 ] . toString ( ) )
6364 . replace ( '{y}' , function ( ) {
0 commit comments