export declare const CITY_SOURCE_SCHEMA: "helix.city-source/1"; export declare const CITY_SOURCE_DEM_SCHEMA: "helix.city-source-dem/1"; export declare const CITY_SOURCE_OVERRIDES_SCHEMA: "helix.city-source-overrides/1"; export declare const CITY_SOURCE_MANIFEST_FILE = "city-source.json"; /** Terrain tiles, placement regions and building cells are 256 m; road cells and HLOD coarse cells are 4 x that. */ export declare const CITY_SOURCE_GRID_M = 256; /** Land use, water and coastline may run this far past `frame.boundsXZ`; roads, buildings and POIs may not. */ export declare const CITY_SOURCE_APRON_M = 2048; /** Slack for a coordinate that sits on the bounds line after rounding. */ export declare const CITY_SOURCE_EXTENT_EPS_M = 0.01; /** Every number in a layer row is rounded to this many decimals on write (1 mm), so re-imports are byte-identical. */ export declare const CITY_SOURCE_DECIMALS = 3; export type Vec2 = [number, number]; export type Vec3 = [number, number, number]; /** A closed polygon ring, implicit closure, no repeated points. */ export type Ring = Vec2[]; export declare const CITY_SOURCE_LAYERS: readonly ["roads", "buildings", "areas", "pois", "terrain", "overrides"]; export type CitySourceLayerName = (typeof CITY_SOURCE_LAYERS)[number]; export type CitySourceFileLayerName = Exclude; /** The file names a layer may use. The first is what the writer picks unless the incoming manifest already names another. */ export declare const CITY_SOURCE_LAYER_URIS: Record; export declare const CITY_SOURCE_OVERRIDES_FILE = "overrides.json"; export declare const CITY_SOURCE_DEM_URI = "terrain/dem.json"; export declare const CITY_SOURCE_DEM_RASTER = "dem.r16"; export declare const ROAD_CLASSES: readonly ["motorway", "trunk", "primary", "secondary", "tertiary", "residential", "service", "living", "pedestrian", "cycleway", "footway", "rail", "tram"]; export type RoadClass = (typeof ROAD_CLASSES)[number]; export declare const ROAD_STRUCTURES: readonly ["none", "bridge", "tunnel", "embankment"]; export type RoadStructure = (typeof ROAD_STRUCTURES)[number]; export declare const ROAD_SURFACES: readonly ["asphalt", "concrete", "sett", "gravel", "dirt"]; export type RoadSurface = (typeof ROAD_SURFACES)[number]; export declare const NODE_CONTROLS: readonly ["signal", "stop", "yield", "roundabout", "none"]; export type NodeControl = (typeof NODE_CONTROLS)[number]; export declare const ROOF_SHAPES: readonly ["flat", "gabled", "hipped", "pyramidal", "skillion", "dome", "mansard"]; export type RoofShape = (typeof ROOF_SHAPES)[number]; export declare const BUILDING_USES: readonly ["residential", "commercial", "office", "retail", "industrial", "civic", "religious", "education", "parking", "other"]; export type BuildingUse = (typeof BUILDING_USES)[number]; export declare const FACADE_MATERIALS: readonly ["plaster", "brick", "stone", "glass", "concrete", "metal"]; export type FacadeMaterial = (typeof FACADE_MATERIALS)[number]; export declare const AREA_KINDS: readonly ["park", "grass", "forest", "scrub", "farmland", "residential", "commercial", "industrial", "parking", "plaza", "pitch", "beach", "cemetery", "construction", "rail"]; export type AreaKind = (typeof AREA_KINDS)[number]; export declare const WATER_KINDS: readonly ["ocean", "sea", "lake", "river", "canal", "pond"]; export type WaterKind = (typeof WATER_KINDS)[number]; export declare const DRIVE_SIDES: readonly ["right", "left"]; export type DriveSide = (typeof DRIVE_SIDES)[number]; export declare const VERTICAL_DATUMS: readonly ["EGM2008", "copernicus", "cs2-sea-level", "none"]; export type VerticalDatum = (typeof VERTICAL_DATUMS)[number]; export type CitySourceProjection = /** OSM / geographic: transverse Mercator on the origin meridian, k0 = 1. x = easting, z = -northing. */ { kind: 'local-tm'; originLonLat: Vec2; ellipsoid: 'WGS84'; k0: number; } /** Cities: Skylines II: the cs2 reader's frame, x,y,-z, y -= seaLevelMetres. No lat/lon. */ | { kind: 'cs2'; seaLevelMetres: number; mirror: 'x,y,-z'; } /** Invented: origin at the centre, y = 0 sea level. */ | { kind: 'synthetic'; }; export interface CitySourceFrame { units: 'meters'; axes: 'helix'; projection: CitySourceProjection; verticalDatum: VerticalDatum; /** Scene Y = altitude - originAltitudeM. */ originAltitudeM: number; /** Plan AABB in scene metres: [[minX, minZ], [maxX, maxZ]]. */ boundsXZ: [Vec2, Vec2]; } export interface CitySourceProvenance { source: string; [key: string]: unknown; } export interface CitySourceDefaults { region?: string; driveSide?: DriveSide; style?: string; } export interface CitySourceFileLayer { uri: string; /** Over the layer's canonical serialisation, UNCOMPRESSED (gzip is transport, not identity). */ sha256: string; count: number; } export interface CitySourceRoadsLayer extends Omit { count: { nodes: number; edges: number; }; } export type CitySourceTerrainLayer = { kind: 'flat'; y: number; } /** `uri` is the dem.json sidecar; its own `sha256` covers the raster. */ | { kind: 'dem'; uri: string; sha256: string; } /** A pointer to an existing terrain source folder's terrain.json (relative to this folder). */ | { kind: 'terrain-source'; uri: string; sha256?: string; }; export interface CitySourceLayers { roads?: CitySourceRoadsLayer; buildings?: CitySourceFileLayer; areas?: CitySourceFileLayer; pois?: CitySourceFileLayer; terrain?: CitySourceTerrainLayer; /** Not in design ยง2.3's example: overrides change the source, so they are hashed into its identity like any layer. */ overrides?: CitySourceFileLayer; } export interface CitySourceManifest { schema: typeof CITY_SOURCE_SCHEMA; /** Stable, author-chosen. */ id: string; frame: CitySourceFrame; layers: CitySourceLayers; provenance: CitySourceProvenance[]; defaults: CitySourceDefaults; } /** Free-form source back-references: `{ osmWay: 55 }`, `{ cs2Edge: 4411, cs2Prefab: '...' }`. */ export type CitySourceRef = Record; export interface RoadNode { id: string; p: Vec2; /** Scene Y; optional (CS2 has it, OSM gets it from the DEM). */ y?: number; control?: NodeControl; crossing?: boolean; } export interface RoadLanes { forward: number; backward: number; /** Turn lanes, e.g. `left;through|through|right`. */ turn?: string; } export interface RoadEdge { id: string; a: string; b: string; /** Centreline including both ends; the first point is node `a`'s position and the last is node `b`'s. */ pts: Vec2[]; /** Optional per-point elevation (CS2, bridges); same length as `pts`. */ ys?: number[]; class: RoadClass; lanes?: RoadLanes; /** Carriageway width, kerb to kerb. */ widthM?: number; oneway?: boolean; /** A slip road, on-ramp, off-ramp or interchange link (OSM `*_link`); kept as its parent `class`. Absent = not known. */ ramp?: boolean; layer?: number; structure?: RoadStructure; /** Metres per side; 0 = none. */ sidewalk?: { left: number; right: number; }; surface?: RoadSurface; name?: string; speedKph?: number; src?: CitySourceRef; } export interface RoadGraph { nodes: RoadNode[]; edges: RoadEdge[]; } export interface CityRoof { shape: RoofShape; heightM?: number; directionDeg?: number; colour?: string; } export interface CityBuildingPart { ring: Ring; holes?: Ring[]; minHeightM?: number; heightM?: number; roof?: CityRoof; } export type CityBuildingMesh = { kind: 'cs2-prefab'; prefab: string; transform?: { position?: Vec3; yawDeg?: number; scale?: number; }; } | { kind: 'package'; pin: { packageId: string; version: string; manifestCid: string; }; }; export interface CityBuilding { id: string; ring: Ring; holes?: Ring[]; heightM?: number; minHeightM?: number; levels?: number; minLevel?: number; roof?: CityRoof; use?: BuildingUse; style?: { family?: string; facadeColour?: string; material?: FacadeMaterial; }; parts?: CityBuildingPart[]; mesh?: CityBuildingMesh | null; ground?: { storefront?: boolean; entrances?: Vec2[]; }; src?: CitySourceRef; } export interface CityArea { id: string; ring: Ring; holes?: Ring[]; kind: AreaKind; src?: CitySourceRef; } /** A water body is either a polygon (`ring`) or a river/canal line (`centreline` + `widthM`). */ /** * One flat piece of a body's water: an axis-aligned plan box at its own surface level. A body whose surface is not one plane (a river running * downhill, a canal standing above the sea it joins) carries several; a lake carries one. The box may reach over bank cells the terrain hides. */ export interface CityWaterSurface { /** Plan box `[minX, minZ, maxX, maxZ]`, scene metres. */ box: [number, number, number, number]; /** Scene Y of the water surface. */ levelM: number; /** Scene Y the volume reaches down to (swimming needs water under the feet). */ floorM: number; } export interface CityWater { id: string; kind: WaterKind; ring?: Ring; holes?: Ring[]; centreline?: Vec2[]; widthM?: number; levelM?: number; /** The body's water as flat boxes at their own levels (CS2 imports). Absent: one box over the ring at `levelM`. For `sea`, only the reaches above the open sea. */ surfaces?: CityWaterSurface[]; src?: CitySourceRef; } export interface CityAreas { areas: CityArea[]; water: CityWater[]; /** Polygonised natural=coastline: LAND rings, clipped to bounds + 2 km. */ coastline?: { landRings: Ring[]; }; } export interface CityPoi { id: string; p: Vec2; /** Open vocabulary, snake_case: tree, street_lamp, traffic_signals, bus_stop, bench, shop, ... */ kind: string; tags?: Record; headingDeg?: number; src?: CitySourceRef; } /** The `terrain/dem.json` sidecar. The raster is headerless little-endian uint16, row-major, row 0 = northernmost. */ export interface CityDemMeta { schema: typeof CITY_SOURCE_DEM_SCHEMA; /** File name next to dem.json. */ file: string; format: 'r16'; /** [columns, rows]. */ samples: [number, number]; metresPerSample: number; /** Scene metres of sample (0, 0): sample (i, j) sits at x = origin.x + i*mps, z = origin.z + j*mps. */ originXZ: Vec2; /** Scene Y metres that raw 0 and raw 65535 stand for (already minus `originAltitudeM`). */ heightRangeM: [number, number]; /** Over the raster bytes. */ sha256: string; note?: string; } export interface CityDem { meta: CityDemMeta; r16: Uint8Array; } export type CityTerrain = { kind: 'flat'; y: number; } | { kind: 'dem'; dem: CityDem; } | { kind: 'terrain-source'; uri: string; sha256?: string; }; /** Hand edits by id, applied last. `set` is a JSON merge patch (null deletes a field); `id` cannot change. */ export type CityOverrideOp = { op: 'delete'; target: string; note?: string; } | { op: 'set'; target: string; set: Record; note?: string; }; export interface CityOverrides { schema: typeof CITY_SOURCE_OVERRIDES_SCHEMA; ops: CityOverrideOp[]; } /** * A layer is present exactly when its field is defined (and, on disk, when the manifest declares it). Writing ignores the * counts and hashes in `manifest.layers` and recomputes them; reading fills them in as stored. */ export interface CitySource { manifest: CitySourceManifest; roads?: RoadGraph; buildings?: CityBuilding[]; areas?: CityAreas; pois?: CityPoi[]; terrain?: CityTerrain; overrides?: CityOverrides; } /** What the writer needs: the manifest without the part it computes. `layers` may be omitted or stale. */ export type CitySourceDraft = Omit & { manifest: Omit & { schema?: typeof CITY_SOURCE_SCHEMA; layers?: CitySourceLayers; }; }; export type IssueSeverity = 'error' | 'warning'; export type IssueScope = CitySourceLayerName | 'manifest' | 'overrides' | 'folder'; export interface CitySourceIssue { severity: IssueSeverity; /** Stable machine code, e.g. `ring.self-intersection`, `road.edge.dangling`. */ code: string; scope: IssueScope; /** The row the issue is about, when it is about one. */ id?: string; message: string; } export interface CitySourceLayerReport { uri?: string; /** Terrain only: flat, dem or terrain-source. */ kind?: string; /** As declared in the manifest. */ sha256?: string; /** Recomputed from the bytes on disk (folder validation only). */ actualSha256?: string; hashOk?: boolean; count: number | { nodes: number; edges: number; } | null; } export interface CitySourceValidationReport { ok: boolean; schema: string | null; id: string | null; errors: number; warnings: number; /** Total occurrences per code (the `issues` list is capped per code). */ totals: Record; issues: CitySourceIssue[]; layers: Partial>; } /** Thrown by the strict reader/writer; `issues` carries every problem found, not just the first. */ export declare class CitySourceError extends Error { readonly issues: CitySourceIssue[]; constructor(message: string, issues?: CitySourceIssue[]); }