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
using OsmSharp.Streams;
using System;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
namespace Sample.CompleteStream
{
class Program
{
/// <summary>
/// Downloads a file if it doesn't exist yet.
/// </summary>
public static async Task ToFile(string url, string filename)
{
if (!File.Exists(filename))
{
var client = new HttpClient();
using (var stream = await client.GetStreamAsync(url))
using (var outputStream = File.OpenWrite(filename))
{
stream.CopyTo(outputStream);
}
}
}
static void Main(string[] args)
{
ToFile("http://download.openstreetmap.fr/extracts/europe/ukraine//kiev.osm.pbf", "kiev.osm.pbf").Wait();
using (var fileStream = File.OpenRead("kiev.osm.pbf"))
{
// create source stream.
var source = new PBFOsmStreamSource(fileStream);
var complete = source.Where(_ => true).ToComplete();
var counted = complete.GroupBy(osmGeo => osmGeo.Type).Select(group => (group.Key, group.Count()));
foreach (var (k, v) in counted)
{
Console.WriteLine($"{k}={v}");
}
}
}
}
}
Run the code above against either current master or with dotnet add package OsmSharp for either netcoreapp2.1 or netcoreapp3.1.
See Stack Overflow printed on the console with no additional info.
P.S. Omitting .Where(_ => true) will fail in the same way.
The text was updated successfully, but these errors were encountered:
I'm currently trying to complete ALL ukraine-latest.osm.pbf using Sample.GeometryStream project. 36.3 GB of RAM was used, with Stack overflow. printed. Seems that situation is quite the same as in the issue.
master
or withdotnet add package OsmSharp
for eithernetcoreapp2.1
ornetcoreapp3.1
.Stack Overflow
printed on the console with no additional info.P.S. Omitting
.Where(_ => true)
will fail in the same way.The text was updated successfully, but these errors were encountered: