You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry of this is the wrong way to ask but I could see a better way. I am working with this and have a problem. I am parsing through a large pbs file and want to loop through certain nodes/ways but I need to be able to get the lat and lon from the "element" but I cant see it, code below. Problem is that OSMGEO doesnt know about those attributes so how can I get them?
namespace OsmSharp
{
public abstract class OsmGeo
{
protected OsmGeo();
public long? Id { get; set; }
public OsmGeoType Type { get; protected set; }
public TagsCollectionBase Tags { get; set; }
public long? ChangeSetId { get; set; }
public bool? Visible { get; set; }
public DateTime? TimeStamp { get; set; }
public int? Version { get; set; }
public long? UserId { get; set; }
public string UserName { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using OsmSharp;
using OsmSharp.Changesets;
using OsmSharp.Complete;
using OsmSharp.IO.PBF;
using OsmSharp.IO.Xml;
using OsmSharp.Logging;
using OsmSharp.Streams;
namespace readosmdata
{
class Program
{
static void Main(string[] args)
{
using (var fileStream = new FileInfo(@"D:/Users/Johan/MyDocuments/Projects/readosmdata/europe-latest.osm.pbf").OpenRead())
{
var source = new PBFOsmStreamSource(fileStream);
Console.WriteLine(DateTime.Now);
var filtered = from osmGeo in source
where osmGeo.Type == OsmGeoType.Node ||
(osmGeo.Type == OsmGeoType.Way && osmGeo.Tags != null && osmGeo.Tags.Contains("power", "line"))
select osmGeo;
var complete = filtered.ToComplete();
foreach (OsmGeo element in complete)
{
foreach (var subTag in element.Tags)
{
if (subTag.Key.ToLower().Equals("building") || subTag.Key.ToLower().Equals("highway") ||
subTag.Key.ToLower().Equals("footpath") || subTag.Key.ToLower().Equals("power"))
{
Console.WriteLine(subTag.Key + " = " + subTag.Value);
}
}
//Console.WriteLine(element.ToString());
}
Console.WriteLine(DateTime.Now);
}
}
}
}
The text was updated successfully, but these errors were encountered:
Sorry of this is the wrong way to ask but I could see a better way. I am working with this and have a problem. I am parsing through a large pbs file and want to loop through certain nodes/ways but I need to be able to get the lat and lon from the "element" but I cant see it, code below. Problem is that OSMGEO doesnt know about those attributes so how can I get them?
namespace OsmSharp
{
public abstract class OsmGeo
{
protected OsmGeo();
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using OsmSharp;
using OsmSharp.Changesets;
using OsmSharp.Complete;
using OsmSharp.IO.PBF;
using OsmSharp.IO.Xml;
using OsmSharp.Logging;
using OsmSharp.Streams;
namespace readosmdata
{
class Program
{
static void Main(string[] args)
{
using (var fileStream = new FileInfo(@"D:/Users/Johan/MyDocuments/Projects/readosmdata/europe-latest.osm.pbf").OpenRead())
{
var source = new PBFOsmStreamSource(fileStream);
}
The text was updated successfully, but these errors were encountered: