All Projects → OsmSharp → Core

OsmSharp / Core

Licence: other
The core functionality of OsmSharp.

Labels

Projects that are alternatives of or similar to Core

Stream Site
Rachni - nginx RTMP streaming front end
Stars: ✭ 172 (-18.1%)
Mutual labels:  stream
Xstream
An extremely intuitive, small, and fast functional reactive stream library for JavaScript
Stars: ✭ 2,259 (+975.71%)
Mutual labels:  stream
Firebase Esp32
ESP32 Firebase RTDB Arduino Library
Stars: ✭ 204 (-2.86%)
Mutual labels:  stream
Audioplayer
Audio Player for Nextcloud and ownCloud
Stars: ✭ 179 (-14.76%)
Mutual labels:  stream
Node Instagram
Instagram api client for node that support promises.
Stars: ✭ 185 (-11.9%)
Mutual labels:  stream
Vlc Bittorrent
A bittorrent plugin for VLC.
Stars: ✭ 198 (-5.71%)
Mutual labels:  stream
Quic.net
A .NET C# Implementation of QUIC protocol - Google's experimental transport layer.
Stars: ✭ 173 (-17.62%)
Mutual labels:  stream
Byte Stream
A non-blocking stream abstraction for PHP based on Amp.
Stars: ✭ 208 (-0.95%)
Mutual labels:  stream
Redis4cats
🔖 Redis client built on top of Cats Effect, Fs2 and Lettuce
Stars: ✭ 189 (-10%)
Mutual labels:  stream
Fastcast
🌊 Stream peer-to-peer audio and video content
Stars: ✭ 202 (-3.81%)
Mutual labels:  stream
Hstream
The streaming database built for IoT data storage and real-time processing in the 5G Era
Stars: ✭ 166 (-20.95%)
Mutual labels:  stream
Render Media
Intelligently render media files in the browser
Stars: ✭ 181 (-13.81%)
Mutual labels:  stream
Kinesis Consumer
Golang library for consuming Kinesis stream data
Stars: ✭ 198 (-5.71%)
Mutual labels:  stream
Piping Server
Infinitely transfer between every device over pure HTTP with pipes or browsers
Stars: ✭ 2,330 (+1009.52%)
Mutual labels:  stream
Copilot
A stream-based runtime-verification framework for generating hard real-time C code.
Stars: ✭ 204 (-2.86%)
Mutual labels:  stream
Scramjet
Simple yet powerful live data computation framework
Stars: ✭ 171 (-18.57%)
Mutual labels:  stream
Amazonriver
amazonriver 是一个将postgresql的实时数据同步到es或kafka的服务
Stars: ✭ 198 (-5.71%)
Mutual labels:  stream
Ixjava
Iterable Extensions for Java 6+
Stars: ✭ 210 (+0%)
Mutual labels:  stream
Streamsaver.js
StreamSaver writes stream to the filesystem directly asynchronous
Stars: ✭ 2,784 (+1225.71%)
Mutual labels:  stream
Gnome Shell Extension Cast To Tv
Cast files to Chromecast, web browser or media player app over local network.
Stars: ✭ 200 (-4.76%)
Mutual labels:  stream

OsmSharp

Build statusVisit our website MIT licensed

  • OsmSharp: NuGet Badge NuGet Badge
  • OsmSharp.Geo: NuGet Badge NuGet Badge

OsmSharp enables you to work directly with OSM-data in .NET. Most important features are:

  • Read/Write OSM-XML.
  • Read/Write OSM-PBF.
  • Streamed architecture, minimal memory footprint.
  • Convert a stream of native OSM objects to 'complete' OSM objects: Ways with all their actual nodes, Relations with all members instantiated.
  • Convert OSM objects to geometries.

Documentation & Samples

Check the documentation website for documentation and sample code. Don't hesitate to ask questions using an issue or request more documentation on any topic you need.

There are 5 sample projects in the samples folder:

  • Sample.CompleteStream: Convert Ways and Relation into objects with nodes and members instantiated.
  • Sample.Filter: Filter data from an OSM file using LINQ.
  • Sample.GeoFilter: Filter data using a bounding box or polygon.
  • Sample.GeometryStream: Extract all power lines from an OSM file, convert them to linestring features and write to GeoJSON.
  • Sample.GeometryStream.Shape: Extract all power lines from an OSM file, convert them to linestring features and write to a shapefile.

Install

PM> Install-Package OsmSharp

There's also a package to use NTS together with OsmSharp to convert OSM-data to features/geometries.

PM> Install-Package OsmSharp.Geo

Usage

A really good way to get started is to have a look at the samples but we collected a few code-snippets for you here anyway:

A 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.

Read data from an OSM-PBF file:

using(var fileStream = new FileInfo(@"/path/to/some/osmfile.osm.pbf").OpenRead())
{
  var source = new PBFOsmStreamSource(fileStream);
  foreach (var element in source)
  {
    Console.WriteLine(element.ToString());
  }
}

Write data to an OSM-PBF file:

using(var fileStream = new FileInfo(@"/path/to/my/osmfile.osm.pbf").OpenRead())
{
	var target = new PBFOsmStreamTarget(fileStream);
	target.Initialize();
	target.AddNode(new Node()
		{
			Id = 1,
			ChangeSetId = 1,
			Latitude = 0,
			Longitude = 0,
			Tags = new TagsCollection(
				Tag.Create("key", "value")),
			TimeStamp = DateTime.Now,
			UserId = 1424,
			UserName = "you",
			Version = 1,
			Visible = true
		});
	target.Flush();
	target.Close();
}

Filter an area and extract a smaller region:

var source = new PBFOsmStreamSource(
	new FileInfo(@"/path/to/file.osm.pbf").OpenRead());

var filtered = source.FilterBox(6.238002777099609f, 49.72076145492323f, 
	6.272850036621093f, 49.69928180928878f); // left, top, right, bottom

using (var stream = new FileInfo(@"/path/to/filterede.osm.pbf").Open(FileMode.Create, FileAccess.ReadWrite))
{
   var target = new PBFOsmStreamTarget(stream);
   target.RegisterSource(filtered);
   target.Pull();
}

Licensing

The OsmSharp project is licensed under the MIT license.

This project includes some code from SharpZipLib, also MIT licensed.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].