コード例 #1
0
        private void ExportRaster(Raster raster, string path, string fileName)
        {
            // Open data store.
            FileSystemConnectionPath connectionPath =
                new FileSystemConnectionPath(new Uri(path), FileSystemDatastoreType.Raster);

            using (FileSystemDatastore datastore = new FileSystemDatastore(connectionPath))
            {
                using (raster.SaveAs(fileName + ".tif", datastore, "TIFF"))
                {
                    datastore.Dispose();
                    raster.Dispose();
                }

                datastore.Dispose();
            }
        }
コード例 #2
0
        private Raster OpenRasterFromDataset(string path, string rasterDatasetFileName)
        {
            Raster raster;
            FileSystemConnectionPath connectionPath =
                new FileSystemConnectionPath(new Uri(path), FileSystemDatastoreType.Raster);

            using (FileSystemDatastore datastore = new FileSystemDatastore(connectionPath))
            {
                using (RasterDataset rasterDataset = datastore.OpenDataset <RasterDataset>(rasterDatasetFileName))
                {
                    // Create a full raster from the raster dataset.
                    raster = rasterDataset.CreateFullRaster();
                    rasterDataset.Dispose();
                }
                datastore.Dispose();
            }

            return(raster);
        }