{"id":23251159,"url":"https://github.com/osmsharp/core","last_synced_at":"2025-04-05T03:12:38.288Z","repository":{"id":3959367,"uuid":"41379799","full_name":"OsmSharp/core","owner":"OsmSharp","description":"The core functionality of OsmSharp.","archived":false,"fork":false,"pushed_at":"2024-07-09T21:36:08.000Z","size":22452,"stargazers_count":323,"open_issues_count":27,"forks_count":89,"subscribers_count":27,"default_branch":"develop","last_synced_at":"2025-03-29T02:09:16.060Z","etag":null,"topics":["geometries","osm-data","osm-pbf","osmsharp","stream"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OsmSharp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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-08-25T18:09:16.000Z","updated_at":"2025-03-24T14:22:05.000Z","dependencies_parsed_at":"2025-01-16T13:34:11.339Z","dependency_job_id":"74415627-739e-4099-acfb-23c011d464fa","html_url":"https://github.com/OsmSharp/core","commit_stats":{"total_commits":353,"total_committers":19,"mean_commits":18.57894736842105,"dds":"0.17563739376770537","last_synced_commit":"b7c5b34eac164850686cadbe9cef47a4a2e4e963"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OsmSharp%2Fcore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OsmSharp%2Fcore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OsmSharp%2Fcore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OsmSharp%2Fcore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OsmSharp","download_url":"https://codeload.github.com/OsmSharp/core/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247280272,"owners_count":20912967,"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":["geometries","osm-data","osm-pbf","osmsharp","stream"],"created_at":"2024-12-19T09:16:48.996Z","updated_at":"2025-04-05T03:12:38.272Z","avatar_url":"https://github.com/OsmSharp.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OsmSharp\n\n[![Prerelease](https://github.com/OsmSharp/core/actions/workflows/develop.yml/badge.svg)](https://github.com/OsmSharp/core/actions/workflows/develop.yml)[![Visit our website](https://img.shields.io/badge/website-osmsharp.com-020031.svg) ](http://www.osmsharp.com/)[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/OsmSharp/core/blob/develop/LICENSE.md)  \n\n- OsmSharp: [![NuGet Badge](https://buildstats.info/nuget/OsmSharp)](https://www.nuget.org/packages/OsmSharp/) [![NuGet Badge](https://buildstats.info/nuget/OsmSharp?includePreReleases=true)](https://www.nuget.org/packages/OsmSharp)  \n- OsmSharp.Geo: [![NuGet Badge](https://buildstats.info/nuget/OsmSharp.Geo)](https://www.nuget.org/packages/OsmSharp.Geo) [![NuGet Badge](https://buildstats.info/nuget/OsmSharp.Geo?includePreReleases=true)](https://www.nuget.org/packages/OsmSharp.Geo)  \n\nOsmSharp enables you to work directly with OpenStreetMap (OSM) data in .NET. Most important features are:\n\n- Read/Write OSM-XML.\n- Read/Write OSM-PBF.\n- Streamed architecture, minimal memory footprint.\n- Convert a stream of native OSM objects to 'complete' OSM objects: Ways with all their actual nodes, Relations with all members instantiated.\n- Convert OSM objects to geometries.\n\n### Documentation \u0026 Samples\n\nCheck the [documentation website](http://docs.itinero.tech/docs/osmsharp/index.html) for documentation and sample code. Don't hesitate to ask questions using an [issue](https://github.com/osmsharp/core/issues) or request more documentation on any topic you need.\n\nThere are 5 sample projects in the `samples` folder:\n\n- Sample.CompleteStream: Convert Ways and Relation into objects with nodes and members instantiated.\n- Sample.Filter: Filter data from an OSM file using LINQ.\n- Sample.GeoFilter: Filter data using a bounding box or polygon.\n- Sample.GeometryStream: Extract all power lines from an OSM file, convert them to linestring features and write to GeoJSON.\n- Sample.GeometryStream.Shape: Extract all power lines from an OSM file, convert them to linestring features and write to a shapefile.\n\n### Install\n\n    PM\u003e Install-Package OsmSharp\n    \nThere's also a package to use [NTS](https://github.com/NetTopologySuite/) together with OsmSharp to convert OSM-data to features/geometries.\n\n    PM\u003e Install-Package OsmSharp.Geo\n\n### Usage\n\nA really good way to get started is to have a look at the [samples](https://github.com/OsmSharp/core/tree/master/samples) but we collected a few code-snippets for you here anyway:\n\nA common usecase is to stream and filter OSM data. To read from an OSM file and enumerate all objects just open the file as a stream source and use foreach.\n\nRead data from an OSM-PBF file:\n\n```csharp\nusing(var fileStream = new FileInfo(@\"/path/to/some/osmfile.osm.pbf\").OpenRead())\n{\n  var source = new PBFOsmStreamSource(fileStream);\n  foreach (var element in source)\n  {\n    Console.WriteLine(element.ToString());\n  }\n}\n```\n\nWrite data to an OSM-PBF file:\n\n```csharp\nusing(var fileStream = new FileInfo(@\"/path/to/my/osmfile.osm.pbf\").OpenRead())\n{\n\tvar target = new PBFOsmStreamTarget(fileStream);\n\ttarget.Initialize();\n\ttarget.AddNode(new Node()\n\t\t{\n\t\t\tId = 1,\n\t\t\tChangeSetId = 1,\n\t\t\tLatitude = 0,\n\t\t\tLongitude = 0,\n\t\t\tTags = new TagsCollection(\n\t\t\t\tTag.Create(\"key\", \"value\")),\n\t\t\tTimeStamp = DateTime.Now,\n\t\t\tUserId = 1424,\n\t\t\tUserName = \"you\",\n\t\t\tVersion = 1,\n\t\t\tVisible = true\n\t\t});\n\ttarget.Flush();\n\ttarget.Close();\n}\n```\n\nFilter an area and extract a smaller region:\n\n```csharp\nvar source = new PBFOsmStreamSource(\n\tnew FileInfo(@\"/path/to/file.osm.pbf\").OpenRead());\n\nvar filtered = source.FilterBox(6.238002777099609f, 49.72076145492323f, \n\t6.272850036621093f, 49.69928180928878f); // left, top, right, bottom\n\nusing (var stream = new FileInfo(@\"/path/to/filterede.osm.pbf\").Open(FileMode.Create, FileAccess.ReadWrite))\n{\n   var target = new PBFOsmStreamTarget(stream);\n   target.RegisterSource(filtered);\n   target.Pull();\n}\n```\n\n### Licensing\n\nThe OsmSharp project is licensed under the [MIT license](https://github.com/OsmSharp/core/blob/master/LICENSE.md).\n\nThis project includes some code from [SharpZipLib](https://github.com/icsharpcode/SharpZipLib), also MIT licensed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosmsharp%2Fcore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fosmsharp%2Fcore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosmsharp%2Fcore/lists"}