{"id":18747722,"url":"https://github.com/thomersch/gosmparse","last_synced_at":"2025-04-12T22:31:45.900Z","repository":{"id":54885524,"uuid":"45707503","full_name":"thomersch/gosmparse","owner":"thomersch","description":"Processing OpenStreetMap PBF files at speed with Go","archived":false,"fork":false,"pushed_at":"2024-03-13T21:28:30.000Z","size":359,"stargazers_count":61,"open_issues_count":4,"forks_count":7,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-26T16:38:52.671Z","etag":null,"topics":["go","golang","openstreetmap","osm","parser","pbf","protobuf"],"latest_commit_sha":null,"homepage":"","language":"Go","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/thomersch.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":"2015-11-06T21:03:49.000Z","updated_at":"2024-11-06T11:55:04.000Z","dependencies_parsed_at":"2024-11-07T16:37:01.282Z","dependency_job_id":"3769ba66-9b5a-491c-ad0b-eb0514519608","html_url":"https://github.com/thomersch/gosmparse","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomersch%2Fgosmparse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomersch%2Fgosmparse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomersch%2Fgosmparse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomersch%2Fgosmparse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thomersch","download_url":"https://codeload.github.com/thomersch/gosmparse/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248640375,"owners_count":21138029,"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":["go","golang","openstreetmap","osm","parser","pbf","protobuf"],"created_at":"2024-11-07T16:31:08.823Z","updated_at":"2025-04-12T22:31:45.873Z","avatar_url":"https://github.com/thomersch.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenStreetMap PBF Parser in Go\n\n[![GoDoc](https://godoc.org/github.com/thomersch/gosmparse?status.svg)](https://godoc.org/github.com/thomersch/gosmparse)\n\ngosmparse uses a callback driven API, which is stable ([Documentation](https://godoc.org/github.com/thomersch/gosmparse)).\n\nIt has been designed with performance and maximum usage convenience in mind; on an Intel Core i7-6820HQ with NVMe flash it is able to process ~75 MB/s, so a planet file can be processed in under 10 minutes. If you find possible speed-ups or other improvements, let me know.\n\n\n## Characteristics\n\n* fast\n* tested with different files from different sources/generators\n* more than 85% test coverage and benchmarks for all hot spots\n* one dependency only: [protobuf package](google.golang.org/protobuf) (a few more are used by tests and are included in the module)\n* can read from any io.Reader (e.g. for parsing during download)\n* supports history files\n\n### Non-Features\n\n* Does not build geometries\n* No element cache\n\n## Install\n\n```\ngo get -u github.com/thomersch/gosmparse\n```\n\n## Example Usage\n\n```go\n// Implement the gosmparser.OSMReader interface here.\n// Streaming data will call those functions.\ntype dataHandler struct{}\n\nfunc (d *dataHandler) ReadNode(n gosmparse.Node)         {}\nfunc (d *dataHandler) ReadWay(w gosmparse.Way)           {}\nfunc (d *dataHandler) ReadRelation(r gosmparse.Relation) {}\n\nfunc ExampleNewDecoder() {\n\tr, err := os.Open(\"filename.pbf\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdec := gosmparse.NewDecoder(r)\n\t// Parse will block until it is done or an error occurs.\n\terr = dec.Parse(\u0026dataHandler{})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}\n```\n\n## Download \u0026 Parse\n\nIt is possible to parse during download, so you don't have to wait for a download to finish to be able to start the parsing/processing. You can simply use the standard Go `net/http` package and pass `resp.Body` to the decoder.\n\n```go\nresp, err := http.Get(\"http://download.geofabrik.de/europe/germany/bremen-latest.osm.pbf\")\nif err != nil {\n\tpanic(err)\n}\ndefer resp.Body.Close()\ndec := gosmparse.NewDecoder(resp.Body)\nerr = dec.Parse(\u0026dataHandler{})\nif err != nil {\n\tpanic(err)\n}\n```\n\n## Did it break?\n\nIf you found a case, where gosmparse broke, please report it and provide the file that caused the failure.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomersch%2Fgosmparse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomersch%2Fgosmparse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomersch%2Fgosmparse/lists"}