{"id":15202944,"url":"https://github.com/nextbillion-ai/pbf-craft","last_synced_at":"2025-10-28T23:31:26.796Z","repository":{"id":257640661,"uuid":"858756006","full_name":"nextbillion-ai/pbf-craft","owner":"nextbillion-ai","description":"A Rust library and command-line tool for reading and writing OpenSteetMap PBF file format.","archived":false,"fork":false,"pushed_at":"2025-01-23T18:35:08.000Z","size":2007,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-01T19:39:26.193Z","etag":null,"topics":["encoding-decoding","osm","parser-library","pbf"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nextbillion-ai.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}},"created_at":"2024-09-17T13:34:05.000Z","updated_at":"2025-01-23T18:34:42.000Z","dependencies_parsed_at":"2024-09-17T22:20:44.064Z","dependency_job_id":"b7ac7b17-bb30-4db2-aea0-54ef75b06b7c","html_url":"https://github.com/nextbillion-ai/pbf-craft","commit_stats":null,"previous_names":["nextbillion-ai/pbf-craft"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextbillion-ai%2Fpbf-craft","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextbillion-ai%2Fpbf-craft/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextbillion-ai%2Fpbf-craft/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nextbillion-ai%2Fpbf-craft/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nextbillion-ai","download_url":"https://codeload.github.com/nextbillion-ai/pbf-craft/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238738034,"owners_count":19522299,"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":["encoding-decoding","osm","parser-library","pbf"],"created_at":"2024-09-28T04:07:26.680Z","updated_at":"2025-10-28T23:31:26.334Z","avatar_url":"https://github.com/nextbillion-ai.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pbf-craft\n\nA Rust library and command-line tool for reading and writing OpenStreetMap PBF file format.\n\nIt contains a variety of PBF readers for a variety of scenarios. For example, a PBF\nreader with an index can locate and read elements more efficiently. It also provides\na PBF writer that can write PBF data to a file.\n\nSince this crate uses the btree_cursors feature, it requires you to use the **nightly**\nversion of rust.\n\n- Written in pure Rust\n- Provides an indexing feature to the PBF to greatly improve read performance.\n\n## Example\n\nReading a PBF file:\n\n```rust\nuse pbf_craft::readers::PbfReader;\n\nlet mut reader = PbfReader::from_path(\"resources/andorra-latest.osm.pbf\").unwrap();\nreader.read(|header, element| {\n    if let Some(header_reader) = header {\n        // Process header\n    }\n    if let Some(element) = element {\n        // Process element\n    }\n}).unwrap();\n```\n\nFinding an element using the index feature. `IndexedReader` creates an index file for the PBF file, which allows you to quickly locate and retrieve an element when looking for it using its ID. `IndexedReader` has an cache option, with which you can fetch a element with its dependencies more efficiently.\n\n```rust\nuse pbf_craft::models::ElementType;\nuse pbf_craft::readers::IndexedReader;\n\nlet mut indexed_reader = IndexedReader::from_path_with_cache(\"resources/andorra-latest.osm.pbf\", 1000).unwrap();\nlet node = indexed_reader.find(\u0026ElementType::Node, 12345678).unwrap();\nlet element_list = indexed_reader.get_with_deps(\u0026ElementType::Way, 1055523837).unwrap();\n```\n\nWriting a PBF file:\n\n```rust\nuse pbf_craft::models::{Element, Node};\nuse pbf_craft::writers::PbfWriter;\n\nlet mut writer = PbfWriter::from_path(\"resources/output.osm.pbf\", true).unwrap();\nwriter.write(Element::Node(Node::default())).unwrap();\nwriter.finish().unwrap();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnextbillion-ai%2Fpbf-craft","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnextbillion-ai%2Fpbf-craft","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnextbillion-ai%2Fpbf-craft/lists"}