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
According to this issue #75, XML exported from overpass should work perfectly fine. I'm running OSMSharp 6.2.0 from Nuget. I have a seemingly simple issue, but OSMSharp seems to be ignoring the Nodes and Ways from the XML (I assume because they don't have the correct attributes, such as version etc.)
My code is very trivial:
using (var fileStream = new FileInfo(@"tmp.osm").OpenRead())
{
var source = new OsmSharp.Streams.XmlOsmStreamSource(fileStream);
var filtered = from osmGeo in source
where osmGeo.Type == OsmGeoType.Way || osmGeo.Type == OsmGeoType.Node
select osmGeo;
var features = filtered.ToFeatureSource();
foreach (var e in features)
{
Console.WriteLine("---" + e.Geometry.ToString());
}
}
I'm simply trying to read an OSM from overpass, extract the data as Polygons and use Mapsui to show them. However, features always returns empty. The foreach is never hit.
The OSM file is below, just one simple polygon. tmp.osm.txt
Is there something I'm missing, or is this a bug?
The text was updated successfully, but these errors were encountered:
Seems like you don't get anything when you read the file?
Try:
using (var fileStream = File.OpenRead("tmp.osm.txt"))
{
XmlSerializer Serializer = new XmlSerializer(typeof(Osm));
var osm = (Osm)Serializer.Deserialize(fileStream);
var way = osm.Ways[0];
}
you'll need a using: System.Xml.Serialization;
xivk
changed the title
Not working with overpass XML
Overpass XML cannot be read with XmlOsmStreamSource.
May 10, 2021
According to this issue #75, XML exported from overpass should work perfectly fine. I'm running OSMSharp 6.2.0 from Nuget. I have a seemingly simple issue, but OSMSharp seems to be ignoring the Nodes and Ways from the XML (I assume because they don't have the correct attributes, such as version etc.)
My code is very trivial:
I'm simply trying to read an OSM from overpass, extract the data as Polygons and use Mapsui to show them. However,
features
always returns empty. The foreach is never hit.The OSM file is below, just one simple polygon.
tmp.osm.txt
Is there something I'm missing, or is this a bug?
The text was updated successfully, but these errors were encountered: