{"id":19411105,"url":"https://github.com/andogq/map_renderer","last_synced_at":"2025-06-14T11:34:03.470Z","repository":{"id":177595352,"uuid":"652089939","full_name":"andogq/map_renderer","owner":"andogq","description":"Open Street Maps renderer built with Rust and OpenGL","archived":false,"fork":false,"pushed_at":"2024-03-11T08:18:46.000Z","size":1546,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T11:06:59.280Z","etag":null,"topics":["opengl","osm","pbf","portfolio","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andogq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-06-11T03:49:13.000Z","updated_at":"2024-12-03T23:56:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"7f911d91-7585-4820-a24d-7271fcd2285b","html_url":"https://github.com/andogq/map_renderer","commit_stats":null,"previous_names":["andogq/map_renderer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/andogq/map_renderer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andogq%2Fmap_renderer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andogq%2Fmap_renderer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andogq%2Fmap_renderer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andogq%2Fmap_renderer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andogq","download_url":"https://codeload.github.com/andogq/map_renderer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andogq%2Fmap_renderer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259809331,"owners_count":22914826,"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","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":["opengl","osm","pbf","portfolio","rust"],"created_at":"2024-11-10T12:19:05.272Z","updated_at":"2025-06-14T11:34:03.443Z","avatar_url":"https://github.com/andogq.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"GPU-accelerated rendering PBF files onto an interactive canvas.\n\n![Rendering of Melbourne CBD](/images/melbourne.webp)\n\nMelbourne's CBD, minus the Yarra river which is now a void.\n\nLegend:\n\n- Yellow: Road\n- Blue: Rail (tram and train) line\n- Green: Park land\n- Grey: Building footprint\n- Orange dots: Footpath\n\n# Overview\n\nOpenGL 4.10 (thanks Apple) is used as the graphics API for rendering these files. To achieve this,\nI created a relatively light-weight wrapper over the raw OpenGL calls (provided by the `gl` crate)\nto assist with the creation of the shader programs and associated buffers, uniforms, etc. OpenGL\nwas originally chosen due to my familiarity with it, however I'm interested in porting this to WGPU\nat some point for better compatibility.\n\nThe PBF files are loaded and processed on the CPU, with the ways (OpenStreetMap terminology for\nwhat's effectively a collection of nodes representing _something_, such as a building or a road)\nfiltered out to only include objects of interest (namely roads, parks, buildings, and railways,\nwhich occurs in `/src/osm/way.rs`). These objects of interest then have bespoke rendering rules\n(defined per object in `/src/objects/*.rs`) which effectively boil down to drawing either a line\nand/or some fill. These rendering instructions and node data is all packaged up and sent over to\nthe GPU which will generate any required geometry (such as each of the rectangles for a dashed line\nor rounded vorners). This technique offers a number of benefits, including minimising the amount of\ndata that needs to be sent to the GPU and the time that the CPU spends processing the data. It also\ndecouples the interpretation and style of the map objects from the underlying graphics API,\n(theoretically) making it simpler to migrate at some point.\n\nThe renderer has a perspective camera, and is looking down at a 2D plane in a 3D environment. This\nallows (fairly trivially) for extrusions and models to be included on the map, such as extruding\nthe building footprints, or including models for traffic and other dynamic elements. This could\neven extend to plugging 'real world' data sources in (such as traffic or public transport\ntimetables) to view them in real time on the map. In order to handle mouse interactions with the\nmap (such as clicking and panning), some slightly curly maths was required to project the mouse\nfrom camera space into world space, but the resulting effect is very plesant to use!\n\n# Resources\n\n - [Overpass](https://overpass-turbo.eu/) - Query and select data, and export it to a number of different files\n - [OSM Export](https://www.openstreetmap.org/export#map=19/-37.79574/144.92911) - Easily grab and export a bounding box on a map\n\n# OSM Queries\n\n## Get residential roads within the bounding box\n\n```osm\n[timeout:25][bbox:-37.796223, 144.928243, -37.796100, 144.928732];\n\n(\n  way[\"highway\"=\"residential\"];\n);\n\nout body;\n\u003e;\nout skel qt;\n```\n\n# Other Notes\n\n## Getting data into PBF format\n\n1. Download desired data from one of the links above (export raw data from Overpass API)\n2. Download and compile `osmconvert`: `http get http://m.m.i24.cc/osmconvert.c | cc -x c - -lz -O3 -o osmconvert`\n3. Run the following command to perform the conversion: `cat [downloaded file] | ./osmconvert - --out-pbf -o=[PBF output file]`\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandogq%2Fmap_renderer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandogq%2Fmap_renderer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandogq%2Fmap_renderer/lists"}