Last active
August 29, 2015 14:04
-
-
Save xivk/e61d61dc627cf2e98526 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sourceStream = new PBFOsmStreamSource( | |
new FileInfo(@"path\to\file.osm.pbf").OpenRead()); | |
var completeStreamSource = new OsmSimpleCompleteStreamSource(sourceStream); | |
foreach(var osmGeoComplete in completeStreamSource) | |
{ | |
if(osmGeoComplete.Type == Osm.CompleteOsmType.Way && | |
osmGeoComplete.Tags != null && | |
osmGeoComplete.Tags.ContainsKey("highway")) | |
{ | |
// do something with the road here. | |
// the nodes are actuall here, just extract their coordinates. | |
var completeWay = (osmGeoComplete as CompleteWay); | |
var coordinates = completeWay.GetCoordinates(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This uses a PBF source and wraps this source into a 'complete' stream. The complete stream composes ways and releations with the actual instances of the nodes and members.
Be careful when using this on a large file.