public void NoMultiPartPolygonsWithConnectionGrid(string rasterFile, string flowDirectionGridFile) { var p = new GdalRasterProvider(); var raster = p.Open(rasterFile); var flowDirectionGrid = p.Open(flowDirectionGridFile); var target = new RasterToPolygon(); var outShape = new PolygonShapefile { Filename = FileTools.GetTempFileName(".shp") }; target.Execute(raster, flowDirectionGrid, outShape, new MockProgressHandler()); FileTools.DeleteShapeFile(outShape.Filename); var mpCount = outShape.Features.Count(t => t.BasicGeometry is MultiPolygon); Assert.That(mpCount == 0); }
public void NoMultiPartPolygonsWithConnectionGrid(string rasterFile, string flowDirectionGridFile) { rasterFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, rasterFile); flowDirectionGridFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, flowDirectionGridFile); var p = new GdalRasterProvider(); var raster = p.Open(rasterFile); var flowDirectionGrid = p.Open(flowDirectionGridFile); var target = new RasterToPolygon(); var outShape = new PolygonShapefile { Filename = Path.ChangeExtension(rasterFile, ".shp") }; target.Execute(raster, flowDirectionGrid, outShape, new MockProgressHandler()); var mpCount = outShape.Features.Count(t => t.BasicGeometry is MultiPolygon); Assert.That(mpCount == 0); }
public void CanCreateMultiPartPolygons(string file) { var target = new RasterToPolygon(); var p = new GdalRasterProvider(); var raster = p.Open(file); var outShape = new PolygonShapefile {Filename = FileTools.GetTempFileName(".shp")}; target.Execute(raster, outShape, new MockProgressHandler()); FileTools.DeleteShapeFile(outShape.Filename); var mpCount = outShape.Features.Count(t => t.BasicGeometry is MultiPolygon); Assert.That(mpCount > 0); }
public void CanCreateMultiPartPolygons(string path) { var target = new RasterToPolygon(); var file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, path); var p = new GdalRasterProvider(); var raster = p.Open(file); var outShape = new PolygonShapefile {Filename = Path.ChangeExtension(file, ".shp")}; target.Execute(raster, outShape, new MockProgressHandler()); var mpCount = outShape.Features.Count(t => t.BasicGeometry is MultiPolygon); Assert.That(mpCount > 0); }
public void SaveAsTest() { const string GridDataFolder = @"Data\Grids\"; var p = new GdalRasterProvider(); var sourceGrid = p.Open(GridDataFolder + @"elev_cm_ESRI\elev_cm_clip2\hdr.adf"); var sourceGridMaximum = sourceGrid.Maximum; const string savedGridName = GridDataFolder + @"elev_cm.tif"; sourceGrid.SaveAs(savedGridName); Assert.AreEqual(sourceGrid.Maximum, sourceGridMaximum, 0.0001); var savedSourceGrid = Raster.Open(savedGridName); Assert.AreEqual(sourceGridMaximum, savedSourceGrid.Maximum, 0.0001); sourceGrid.Close(); savedSourceGrid.Close(); File.Delete(savedGridName); }
public void SaveAsTest() { var GridDataFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Data\Grids\"); var p = new GdalRasterProvider(); var sourceGrid = p.Open(GridDataFolder + @"elev_cm_ESRI\elev_cm_clip2\hdr.adf"); var sourceGridMaximum = sourceGrid.Maximum; var savedGridName = GridDataFolder + @"elev_cm.tif"; sourceGrid.SaveAs(savedGridName); Assert.AreEqual(sourceGrid.Maximum, sourceGridMaximum, 0.0001); var savedSourceGrid = Raster.Open(savedGridName); Assert.AreEqual(sourceGridMaximum, savedSourceGrid.Maximum, 0.0001); sourceGrid.Close(); savedSourceGrid.Close(); File.Delete(savedGridName); }
public void SaveAsTest() { var p = new GdalRasterProvider(); var sourceGrid = p.Open(FileTools.PathToTestFile( @"Rasters\elev_cm_ESRI\elev_cm_clip2\hdr.adf")); var sourceGridMaximum = sourceGrid.Maximum; var savedGridName = FileTools.GetTempFileName(".tif"); try { sourceGrid.SaveAs(savedGridName); Assert.AreEqual(sourceGrid.Maximum, sourceGridMaximum, 0.0001); var savedSourceGrid = Raster.Open(savedGridName); Assert.AreEqual(sourceGridMaximum, savedSourceGrid.Maximum, 0.0001); sourceGrid.Close(); savedSourceGrid.Close(); } finally { File.Delete(savedGridName); } }