{"id":30307257,"url":"https://github.com/jgauchia/tile-generator","last_synced_at":"2026-03-15T18:18:33.841Z","repository":{"id":309238437,"uuid":"1035208296","full_name":"jgauchia/Tile-Generator","owner":"jgauchia","description":"This repository contains a Python script for generating vector map tiles from OpenStreetMap (OSM) data in a custom binary format.","archived":false,"fork":false,"pushed_at":"2025-08-10T17:47:20.000Z","size":146,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-10T19:26:36.309Z","etag":null,"topics":["esp32","gps","icenav","osm","tile"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jgauchia.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-09T22:14:41.000Z","updated_at":"2025-08-10T17:45:55.000Z","dependencies_parsed_at":"2025-08-16T03:31:28.169Z","dependency_job_id":null,"html_url":"https://github.com/jgauchia/Tile-Generator","commit_stats":null,"previous_names":["jgauchia/tile-generator"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/jgauchia/Tile-Generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgauchia%2FTile-Generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgauchia%2FTile-Generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgauchia%2FTile-Generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgauchia%2FTile-Generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jgauchia","download_url":"https://codeload.github.com/jgauchia/Tile-Generator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgauchia%2FTile-Generator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270837455,"owners_count":24654386,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["esp32","gps","icenav","osm","tile"],"created_at":"2025-08-17T10:44:44.339Z","updated_at":"2026-03-15T18:18:33.835Z","avatar_url":"https://github.com/jgauchia.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tile-Generator (v0.4.0)\n\nC++ toolset for generating optimized vector map tiles from OpenStreetMap PBF files, targeting ESP32-based GPS navigators.\n\n## Features\n\n- **High-Performance C++ Engine**: OSM PBF parsing and tile generation using GEOS, Osmium, and GDAL.\n- **Four-Pass Rendering Pipeline**: Road casings, bridge decks, and layered text labels.\n- **Smart Text Labels (GEOM_TEXT)**: Collision detection and population-based filtering for place names and road labels.\n- **Packed Binary Containers (NPK2)**: Tiles consolidated into single `Zxx.nav` files per zoom level with Y-table index for O(1) row lookup.\n- **Ocean Water Polygons**: Optional loading of pre-computed water polygons from [osmdata.openstreetmap.de](https://osmdata.openstreetmap.de) shapefiles, with spatial filtering on the PBF bounding box.\n- **Memory Optimized**: POSIX `mmap` feature storage for country-scale processing with low RAM footprint.\n- **Advanced Aesthetics**:\n    - **Multi-Level Boundaries**: International, regional, and municipal borders.\n    - **Smart Filtering**: Automatic removal of tunnels, subway lines, and underground polygons.\n    - **Dynamic Styles**: Line widths (0.5px units) and 16-level priorities via `features.json`.\n- **ESP32 Ready**: VarInt/ZigZag delta encoding and streaming-ready structures.\n- **PC Simulator**: Pygame-based viewer with 4-pass rendering simulation.\n\n---\n\n## Getting Started\n\n### 1. Requirements\nInstall the necessary libraries (Ubuntu/Debian):\n```bash\nsudo apt-get install libosmium2-dev libgeos-dev nlohmann-json3-dev libgdal-dev libboost-dev\n```\n\n### 2. Building the Generator\n```bash\nmkdir build \u0026\u0026 cd build\ncmake ..\nmake -j$(nproc)\n```\n\n### 3. Generating Maps\n```bash\n./nav_generator \u003cinput.pbf\u003e \u003coutput_dir\u003e features.json [--zoom 6-17] [--water-shp \u003cpath\u003e]\n```\n\n### 4. Ocean Water Polygons (optional)\n\nDownload the pre-computed water polygons shapefile (once, ~540 MB):\n```bash\nwget https://osmdata.openstreetmap.de/download/water-polygons-split-4326.zip\nunzip water-polygons-split-4326.zip\n```\n\nGenerate with oceans:\n```bash\n./nav_generator input.pbf output features.json --zoom 6-17 \\\n    --water-shp water-polygons-split-4326/water_polygons.shp\n```\n\nThe generator reads the PBF bounding box and only loads water polygons intersecting the extract area. See [WATER.md](WATER.md) for details.\n\n### 5. Viewing Maps (PC)\n```bash\npython tile_viewer.py \u003coutput_dir\u003e --lat \u003clatitude\u003e --lon \u003clongitude\u003e [--zoom \u003clevel\u003e] --config features.json\n```\n\n---\n\n## Processing Pipeline\n\n```\n1. Config loading (features.json)\n2. Pass 1: RelationScanner (boundaries, water multipolygon relations)\n3. Pass 2: PBF feature extraction (ways, areas → MappedStore)\n4. Pass 3: Water polygon loading from shapefile (optional, --water-shp)\n5. TileProcessor: clip, merge, simplify, emit for all zoom levels → NPK2 packs\n```\n\n---\n\n## Technical Standards\n\n- **Container Format**: NPK2 with Y-table index for O(1) row lookup + binary search within rows.\n- **Tile Format**: NAV1, 13-byte feature header with casing flags and 0.5px width units.\n- **Z-Order**: 16 priority levels (0-15) mapped to a 4-pass rendering pipeline.\n- **Coordinate System**: Web Mercator, 12-bit tile-relative space (0-4096), delta VarInt/ZigZag encoding.\n\nFor detailed binary format specifications, see [`docs/bin_tile_format.md`](docs/bin_tile_format.md).\n\n---\n\n## Author\n**Jordi Gauchía** (jgauchia@jgauchia.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjgauchia%2Ftile-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjgauchia%2Ftile-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjgauchia%2Ftile-generator/lists"}