Exemplo n.º 1
0
        public void OgrDataReaderTestReadGpxRoutesViaBabel()
        {
            var babelPath = GetFullPathFromWindows("GPSbabel.exe");

            if (String.IsNullOrEmpty(babelPath))
            {
                Assert.Ignore("GPSbabel.exe was not found! Ignoring Babel based tests! If left to continue a (System.ApplicationException : Could not create process gpsbabel...) would have been thrown! ");
                return;
            }

            var gpxTestFile = GpxTestFileCreator.CreateMapSourceSimpleWaypointERouteTestFile();

            using (var dr = new OgrDataReader($"GPSBabel:gpx:features=routes:{gpxTestFile}", new GpsBabelFileNameExtractor()))
            {
                var layer = dr.GetLayers().Keys.First();
                Assert.NotNull(layer);
                Assert.AreEqual(4, layer.Vertex.Length);
                var geom = layer.Features[0];
                Assert.AreEqual(1, geom.NumParts());
                Assert.AreEqual(-45.707053346559405, layer.Vertex[0], _tolerance);
                Assert.AreEqual(-23.718632999807596, layer.Vertex[1], _tolerance);
                Assert.AreEqual(-45.714390277862549, layer.Vertex[2], _tolerance);
                Assert.AreEqual(-23.71721469797194, layer.Vertex[3], _tolerance);
                //layer.SaveAs($"OgrDataReaderTestReadGpxRoutesViaBabel\\OgrDataReaderTestReadGpxRoutesViaBabel.shp", true);
            }

            GpxTestFileCreator.DeleteMapSourceSimpleWaypointERouteTestFile();
        }
Exemplo n.º 2
0
        public void OgrDataReaderTestGpsBabelFileNameExtractor()
        {
            var gpxTestFile = GpxTestFileCreator.CreateMapSourceSimpleWaypointERouteTestFile();
            var extracted   = new GpsBabelFileNameExtractor().ExtractFileName($"GPSBabel:gpx:features=tracks:{gpxTestFile}");

            Assert.AreEqual(gpxTestFile, extracted);
            GpxTestFileCreator.DeleteMapSourceSimpleWaypointERouteTestFile();
        }
Exemplo n.º 3
0
        public void OgrDataReaderTestReadGpx()
        {
            var gpxTestFile = GpxTestFileCreator.CreateMapSourceSimpleWaypointERouteTestFile();

            //standard gpx reader only reads waypoints!
            using (var dr = new OgrDataReader(gpxTestFile))
            {
                var layer = dr.GetLayers().Keys.First();
                Assert.NotNull(layer);
                Assert.AreEqual(8, layer.Vertex.Length);
                var geom = layer.Features[0];
                Assert.AreEqual(1, geom.NumParts());
                Assert.AreEqual(-45.707975439727306, layer.Vertex[0], _tolerance);
                Assert.AreEqual(-23.719357447698712, layer.Vertex[1], _tolerance);
                Assert.AreEqual(-45.714390277862549, layer.Vertex[6], _tolerance);
                Assert.AreEqual(-23.71721469797194, layer.Vertex[7], _tolerance);
                //layer.SaveAs($"OgrDataReaderTestReadGpx\\OgrDataReaderTestReadGpx.shp", true);
            }

            GpxTestFileCreator.DeleteMapSourceSimpleWaypointERouteTestFile();
        }