Beispiel #1
0
        /// <summary>
        /// Shows progress when consuming the returned stream.
        /// </summary>
        public static OsmStreamSource ShowProgress(this IEnumerable <OsmGeo> source)
        {
            var progress = new Filters.OsmStreamFilterProgress();

            progress.RegisterSource(source);
            return(progress);
        }
        /// <summary>
        /// Loads a routing network created from OSM data.
        /// </summary>
        public static void LoadOsmData(this RouterDb db, Stream data, bool allCore = false, bool processRestrictions = true, params Itinero.Profiles.Vehicle[] vehicles)
        {
            if (!db.IsEmpty)
            {
                throw new ArgumentException("Can only load a new routing network into an empty router db, add multiple streams at once to load multiple files.");
            }

            // load the data.
            var source   = new PBFOsmStreamSource(data);
            var progress = new OsmSharp.Streams.Filters.OsmStreamFilterProgress();

            progress.RegisterSource(source);
            db.LoadOsmData(progress, allCore, processRestrictions, vehicles);
        }