public void GetCoordinateSystem()
        {
            string           proj;
            CoordinateSystem cs = CoordinateSystem.Other;

            Assert.DoesNotThrowAsync(async() =>
            {
                proj = await GdalWorker.GetProjStringAsync(_in4326).ConfigureAwait(false);
                cs   = GdalWorker.GetCoordinateSystem(proj);
            });
            Assert.True(cs == Cs4326);

            Assert.DoesNotThrowAsync(async() =>
            {
                proj = await GdalWorker.GetProjStringAsync(_in3785).ConfigureAwait(false);
                cs   = GdalWorker.GetCoordinateSystem(proj);
            });
            Assert.True(cs == Cs3857);

            Assert.DoesNotThrowAsync(async() =>
            {
                proj = await GdalWorker.GetProjStringAsync(_in3395).ConfigureAwait(false);
                cs   = GdalWorker.GetCoordinateSystem(proj);
            });
            Assert.True(cs == CsOther);
        }
        public void GetProjStringNormal()
        {
            string proj = null;

            Assert.DoesNotThrowAsync(async() => proj = await GdalWorker.GetProjStringAsync(_in4326).ConfigureAwait(false));

            Assert.False(string.IsNullOrWhiteSpace(proj));
        }
Beispiel #3
0
        public static async ValueTask <bool> CheckInputFileAsync(string inputFilePath, CoordinateSystem targetSystem)
        {
            // File's path checked in other methods, so checking it here is not necessary

            // Get proj and gdalInfo strings
            string projString = await GdalWorker.GetProjStringAsync(inputFilePath).ConfigureAwait(false);

            CoordinateSystem inputSystem    = GdalWorker.GetCoordinateSystem(projString);
            string           gdalInfoString = await GdalWorker.InfoAsync(inputFilePath).ConfigureAwait(false);

            // Check if input image is ready for cropping
            return(inputSystem == targetSystem &&
                   gdalInfoString.Contains(GdalWorker.Byte, StringComparison.InvariantCulture));
        }
 public void GetProjStringNonExistantPath() => Assert.ThrowsAsync <FileNotFoundException>(async() =>
                                                                                          await GdalWorker.GetProjStringAsync(ShouldFail).ConfigureAwait(false));
 public void GetProjStringNullPath() => Assert.ThrowsAsync <ArgumentNullException>(async() =>
                                                                                   await GdalWorker.GetProjStringAsync(null).ConfigureAwait(false));