本文整理汇总了TypeScript中models/tiles/tms_tile_source.TMSTileSource类的典型用法代码示例。如果您正苦于以下问题:TypeScript TMSTileSource类的具体用法?TypeScript TMSTileSource怎么用?TypeScript TMSTileSource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TMSTileSource类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: TMSTileSource
it.skip("should get tile urls by geographic extent", () => {
const tile_options = {
url: 'http://c.tile.openstreetmap.org/{Z}/{X}/{Y}.png',
}
const source = new TMSTileSource(tile_options)
const extent: Extent = [-90.283741, 29.890626, -89.912952, 30.057766]
const level = 11
const expected_tiles = [
'http://c.tile.openstreetmap.org/11/510/1201.png',
'http://c.tile.openstreetmap.org/11/511/1201.png',
'http://c.tile.openstreetmap.org/11/512/1201.png',
'http://c.tile.openstreetmap.org/11/510/1202.png',
'http://c.tile.openstreetmap.org/11/511/1202.png',
'http://c.tile.openstreetmap.org/11/512/1202.png',
]
const tiles = source.get_tiles_by_extent(extent, level)
for (const [x, y, z] of tiles) {
const url = source.get_image_url(x, y, z)
expect(expected_tiles).to.contain(url)
}
})
示例2: it
it("should account of x_origin_offset and y_origin_offset", () => {
const tile_options = {
x_origin_offset: 0,
y_origin_offset: 0,
}
const offset_source = new TMSTileSource(tile_options)
const bounds = offset_source.get_tile_meter_bounds(0, 0, 16)
expect(bounds).to.include(0)
})
示例3: describe
describe("tms tile source", () => {
const url = 'http://c.tiles.mapbox.com/v3/examples.map-szwdot65/{Z}/{X}/{Y}.png'
const source = new TMSTileSource({url})
it("should get tiles for extent correctly", () => {
T.expect_mercator_tile_counts(source)
})
it("should successfully set x_origin_offset and y_origin_offset", () => {
const tile_options = {
x_origin_offset: 0,
y_origin_offset: 0,
}
const offset_source = new TMSTileSource(tile_options)
expect(offset_source.x_origin_offset).to.be.equal(0)
expect(offset_source.y_origin_offset).to.be.equal(0)
})
it("should account of x_origin_offset and y_origin_offset", () => {
const tile_options = {
x_origin_offset: 0,
y_origin_offset: 0,
}
const offset_source = new TMSTileSource(tile_options)
const bounds = offset_source.get_tile_meter_bounds(0, 0, 16)
expect(bounds).to.include(0)
})
it("should calculate resolution", () => {
expect(source.get_resolution(1)).to.be.closeTo(78271.517, tol)
expect(source.get_resolution(12)).to.be.closeTo(38.2185, tol)
})
})