ol7源码学习之TileGrid

WMTSTileGrid

参数:

NameTypeDescription
extentExtent | undefined

瓦片网格的范围

originCoordinate | undefined瓦片网格的原点
originsArray<Coordinate> | undefined

Tile grid origins, i.e. where the x and y axes meet ([z, 0, 0]), for each zoom level. If given, the array length should match the length of the resolutions array, i.e. each resolution can have a different origin. Tile coordinates increase left to right and downwards. If not specified, extent or origin must be provided.

resolutionsArray.<number> 每个分辨率的数组索引需要匹配缩放级别
matrixIdsArray.<string>矩阵id(对应每个分辨率的瓦片数组)。 这个数组的长度需要与resolution数组的长度匹配。 
sizesArray<Size> | undefined

Number of tile rows and columns of the grid for each zoom level. The values here are the TileMatrixWidth and TileMatrixHeight advertised in the GetCapabilities response of the WMTS, and define each zoom level's extent together with the origin or origins. A grid extent can be configured in addition, and will further limit the extent for which tile requests are made by sources. If the bottom-left corner of an extent is used as origin or origins, then the y value must be negative because OpenLayers tile coordinates use the top left as the origin.

tileSizenumber | Size | undefined

Tile size.

tileSizesArray.<(number|module:ol/size~Size)> | undefined

Tile sizes. T

实例:

// create the WMTS tile grid in the google projection
const projection = getProjection('EPSG:3857');
const tileSizePixels = 256;
const tileSizeMtrs = getWidth(projection.getExtent()) / tileSizePixels;
const matrixIds = [];
const resolutions = [];
for (let i = 0; i <= 14; i++) {
  matrixIds[i] = i;
  resolutions[i] = tileSizeMtrs / Math.pow(2, i);
}
const tileGrid = new WMTSTileGrid({
  origin: getTopLeft(projection.getExtent()),
  resolutions: resolutions,
  matrixIds: matrixIds,
});
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值