tile_layout

Contents

tile_layout#

rapidtools.processing.street_tiles.tile_layout(width: int, height: int, is_pano: bool, tile_px: int = 1024, overlap: float = 0.125, elevation_deg: tuple[float, float] = (-26.5, 0.5)) → list[tuple[int, int, int]][source]#

Square tiles that cover the part of a frame where objects stand.

Parameters:
  • width – Width of the frame in pixels.

  • height – Height of the frame.

  • is_pano – Whether the frame is an equirectangular panorama. Its tiles cover the band elevation_deg all the way around, and the last one reaches across the seam. A perspective frame is covered whole.

  • tile_px – Side of a tile. A band about this high is cut as one row of tiles of its own height.

  • overlap – Share of a tile that the next one repeats, at least.

  • elevation_deg – Lower and upper elevation of a panorama’s band.

Returns:

list[tuple[int, int, int]] – (left, top, side) of every tile, in pixels. left + side exceeds width for a tile across the seam of a panorama.

Example

>>> tile_layout(4000, 3000, is_pano=False)[-1]
(2976, 1976, 1024)
>>> len(tile_layout(5760, 2880, is_pano=True))  # a band 432 pixels high
16