Example #1
0
        public void TestReadOsmXmlFile()
        {
            var stopWatch = Stopwatch.StartNew();

            const string file   = @"E:\Research\Maps\Map Files\geofabrik.de.asia\iran-latest.osm";
            var          reader = new OsmXmlMongoReader();

            reader.Open(file);
            reader.Read();

            stopWatch.Stop();
            var totalTime1 = stopWatch.ElapsedMilliseconds;

            stopWatch = Stopwatch.StartNew();

            DataConnector.Instance.Nodes.InsertBatch(reader.Nodes.Values);
            DataConnector.Instance.Ways.InsertBatch(reader.Ways.Values);
            DataConnector.Instance.Relations.InsertBatch(reader.Relations.Values);

            stopWatch.Stop();
            var totalTime2 = stopWatch.ElapsedMilliseconds;


            Debug.WriteLine("Step1 Done in {0} ms", totalTime1);
            Debug.WriteLine("Step2 Done in {0} ms", totalTime2);
        }
Example #2
0
        public void TestReadOsmXmlFileAndInsert()
        {
            var stopWatch = Stopwatch.StartNew();

            const string file   = @"E:\Research\Maps\Map Files\geofabrik.de.asia\iran-latest.osm";
            var          reader = new OsmXmlMongoReader();

            reader.Open(file);
            reader.ReadAndInsertInBulk();

            stopWatch.Stop();
            var totalTime = stopWatch.ElapsedMilliseconds;

            Debug.WriteLine("Done in {0} ms", totalTime);
        }