Skip to content

Instantly share code, notes, and snippets.

@xivk
Created July 25, 2014 09:28
Show Gist options
  • Save xivk/b2cd222d550fab308bc9 to your computer and use it in GitHub Desktop.
Save xivk/b2cd222d550fab308bc9 to your computer and use it in GitHub Desktop.
var sourceStream = new PBFOsmStreamSource(
new FileInfo(@"path\to\file.osm.pbf").OpenRead());
foreach(var osmGeo in sourceStream)
{
if(osmGeo.Type == Osm.OsmGeoType.Way &&
osmGeo.Tags != null &&
osmGeo.Tags.ContainsKey("highway"))
{
// do something with the road here.
// the nodes are just ids. save them from the stream first and get their coordinates.
var way = (osmGeo as Way);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment