public void GetImageBordersNullSize() { string proj = GdalWorker.GetProjString(_in4326); CoordinateSystem cs = GdalWorker.GetCoordinateSystem(proj); Assert.Throws <ArgumentNullException>(() => GdalWorker.GetImageBorders(_in4326, null, cs)); }
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 GetImageBordersNonExistingPath() { using Image image = Image.NewFromFile(_in4326); Size size = new Size(image.Width, image.Height); string proj = GdalWorker.GetProjString(_in4326); CoordinateSystem cs = GdalWorker.GetCoordinateSystem(proj); Assert.Throws <FileNotFoundException>(() => GdalWorker.GetImageBorders(ShouldFail, size, cs)); }
public void GetImageBordersNullPath() { using Image image = Image.NewFromFile(_in4326); Size size = new Size(image.Width, image.Height); string proj = GdalWorker.GetProjString(_in4326); CoordinateSystem cs = GdalWorker.GetCoordinateSystem(proj); Assert.Throws <ArgumentNullException>(() => GdalWorker.GetImageBorders(null, size, cs)); }
public void GetImageBordersNormal() { using Image image = Image.NewFromFile(_in4326); Size size = new Size(image.Width, image.Height); string proj = GdalWorker.GetProjString(_in4326); CoordinateSystem cs = GdalWorker.GetCoordinateSystem(proj); GeoCoordinate minCoordinate = null; GeoCoordinate maxCoordinate = null; Assert.DoesNotThrow(() => (minCoordinate, maxCoordinate) = GdalWorker.GetImageBorders(_in4326, size, cs)); Assert.True(minCoordinate is GeodeticCoordinate && maxCoordinate is GeodeticCoordinate); }
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)); }