feat: 支持多域名瓦片服务地址 (#1206)

* feat: 支持多域名瓦片服务地址

* chore: 格式化代码
This commit is contained in:
lvisei 2022-06-30 14:50:00 +08:00 committed by GitHub
parent bf4d22513d
commit 57eb8a21ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 10 deletions

View File

@ -15,7 +15,12 @@ scene.on('loaded', () => {
zIndex: 1
});
baseLayer.source(
'https://webst01.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
[
'https://webst01.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
'https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
'https://webst03.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
'https://webst04.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}'
],
{
parser: {
type: 'rasterTile',

View File

@ -15,7 +15,10 @@ scene.on('loaded', () => {
zIndex: 1
});
baseLayer.source(
'https://t1.tianditu.gov.cn/DataServer?T=img_w&X={x}&Y={y}&L={z}&tk=6557fd8a19b09d6e91ae6abf9d13ccbd',
[
'https://t1.tianditu.gov.cn/DataServer?T=img_w&X={x}&Y={y}&L={z}&tk=6557fd8a19b09d6e91ae6abf9d13ccbd',
'https://t2.tianditu.gov.cn/DataServer?T=img_w&X={x}&Y={y}&L={z}&tk=6557fd8a19b09d6e91ae6abf9d13ccbd'
],
{
parser: {
type: 'rasterTile',

View File

@ -153,7 +153,7 @@ export type MapboxVectorTile = {
};
const getVectorTile = async (
url: string,
url: string | string[],
tileParams: TileLoadParams,
tile: Tile,
coord: string,
@ -213,7 +213,7 @@ const getVectorTile = async (
};
export default function mapboxVectorTile(
data: string,
data: string | string[],
cfg?: IRasterTileParserCFG,
): IParserData {
const coord = cfg?.coord || 'lnglat'; // lnglat - offset

View File

@ -14,7 +14,7 @@ const DEFAULT_CONFIG: Partial<TilesetManagerOptions> = {
};
export default function rasterTile(
data: string,
data: string | string[],
cfg?: IRasterTileParserCFG,
): IParserData {
const tileDataType: RasterTileType = cfg?.dataType || RasterTileType.IMAGE;

View File

@ -15,7 +15,7 @@ import {
* @returns
*/
export const getTileBuffer = async (
url: string,
url: string | string[],
tileParams: TileLoadParams,
tile: Tile,
rasterParser: any,
@ -39,7 +39,7 @@ export const getTileBuffer = async (
};
export const getTileImage = async (
url: string,
url: string | string[],
tileParams: TileLoadParams,
tile: Tile,
): Promise<HTMLImageElement | ImageBitmap> => {

View File

@ -66,9 +66,12 @@ export default class RasterTile extends React.Component {
});
layer
.source(
'http://webst01.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
// 'http://rd1yhmrzc.hn-bkt.clouddn.com/Mapnik/{z}/{x}/{y}.png',
// 'https://api.maptiler.com/tiles/terrain-rgb/{z}/{x}/{y}.png?key=get_your_own_key_rSw2Lu595oi7U6WngsFQ',
[
'http://webst01.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
'http://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
'http://webst03.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
'http://webst04.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
],
{
parser: {
type: 'rasterTile',