infinite-canvas-tutorial icon indicating copy to clipboard operation
infinite-canvas-tutorial copied to clipboard

Can we also have a chapter about tile-based rendering engine?

Open videni opened this issue 3 months ago • 1 comments

I’ve tried out the Google Maps Pyramid-Based Tile System. The concepts themselves don’t seem hard to grasp, but there are some subtle details that end up making the stroke really blurry even though the zoom level is set to 1.

Google Maps Pyramid-Based Tile System

Core Concept

  1. Pyramid Structure

Zoom 0: 1×1 tile (entire world) Zoom 1: 2×2 tiles Zoom 2: 4×4 tiles ... Zoom n: 2^n × 2^n tiles

  1. Coordinate System
  • X coordinate: West to East (left to right), 0 to 2^zoom-1
  • Y coordinate: North to South (top to bottom), 0 to 2^zoom-1
  • Zoom levels: 0 (furthest out) to 18-22 (closest in)
  1. Tile Properties
  • Standard size: 256×256 pixels
  • World coverage: Geographic area covered by each tile varies by zoom level
  • Relationship: tileWorldSize = earthCircumference / (2^zoom)

How It Works

Level of Detail (LOD)

  • Zoom 0: One tile covers the entire world (low detail)
  • Zoom 10: 1024×1024 tiles, each covering ~153km
  • Zoom 18: 262,144×262,144 tiles, each covering ~0.6m

Coordinate Transformation

// Tile coordinates → World coordinates let minX = Double(x) * tileSize - earthCircumference / 2 let maxY = earthCircumference / 2 - Double(y) * tileSize

videni avatar Aug 22 '25 14:08 videni