View on GitHub

leaflet-city-mapper

A small 3D rendering engine for leaflet

Projections

Source guide Project README

Converts coordinates between geographic, map pixel, screen and local scene spaces, including camera pitch and bearing.

Coordinate spaces

flowchart LR
  Geo["Latitude / longitude"] --> CRS["Map CRS projection"]
  CRS --> Local["Subtract layer origin + latitude scale"]
  Local --> Root["Layer-local metres"]
  Root --> World["Shared world via root transform"]
  World --> Camera["Camera projection"]
  Camera --> Screen["Screen pixels"]

Local coordinates use positive X east and negative Z north. Screen/ground conversion depends on pitch, bearing and view. Do not mix degrees, pixels, layer-local metres and shared-world coordinates.

Related: camera, geometry, transforms.