public Dataset Create(final String name, final int xsize, final int ysize, final int bands, final int eType, final String[] options) { return Create(name, xsize, ysize, bands, eType, StringArrayToVector(options)); }
writeDataset = driver.Create(fileName, destinationWidth, destinationHeight, nBands, dataType, myOptions);
public Dataset Create(final String name, final int xsize, final int ysize, final int bands, final String[] options) { return Create(name, xsize, ysize, bands, gdalconstConstants.GDT_Byte, StringArrayToVector(options)); }
writeDataset = driver.Create(fileName, destinationWidth, destinationHeight, nBands, dataType, myOptions);
public Dataset Create(String name, int xsize, int ysize, int bands, int eType, String[] options) { return Create(name, xsize, ysize, bands, eType, StringArrayToVector(options)); }
public Dataset Create(String name, int xsize, int ysize, int bands, String[] options) { return Create(name, xsize, ysize, bands, gdalconstConstants.GDT_Byte, StringArrayToVector(options)); }
public Dataset extractRegionAsDataset( Envelope region, int pixelsX, int pixelsY, boolean withAlpha ) throws IOException { byte[][] buffer = extractRegionAsByteArray( region, pixelsX, pixelsY, withAlpha ); Driver vrtDriver = gdal.GetDriverByName( "MEM" ); Dataset ds = vrtDriver.Create( "/tmp/whatever", pixelsX, pixelsY, buffer.length ); ds.SetProjection( dataset.GetProjection() ); int i = 1; for ( byte[] bytes : buffer ) { Band band = ds.GetRasterBand( i ); if ( band.WriteRaster( 0, 0, pixelsX, pixelsY, pixelsX, pixelsY, GDT_Byte, bytes ) != CE_None ) { throw new RuntimeException( "Error writing raster band." ); } i++; } return ds; }
private Dataset createMemDataset( Envelope nativeBbox, String nativeProjection, byte[][] composedRegion ) { Driver vrtDriver = gdal.GetDriverByName( "MEM" ); Dataset dataset = vrtDriver.Create( "/tmp/whatever", width, height, composedRegion.length ); dataset.SetProjection( nativeProjection ); dataset.SetGeoTransform( getGeoTransform( nativeBbox, width, height ) ); for ( int i = 1; i <= dataset.getRasterCount(); i++ ) { Band band = dataset.GetRasterBand( i ); if ( band.WriteRaster( 0, 0, width, height, width, height, GDT_Byte, composedRegion[i - 1] ) != CE_None ) { throw new RuntimeException( "Error writing composed raster." ); } } return dataset; }
private Dataset reproject( Dataset src, String dstCrsWkt ) { Driver vrtDriver = gdal.GetDriverByName( "MEM" ); Dataset region = vrtDriver.Create( "/tmp/whatever", width, height, src.getRasterCount() ); region.SetProjection( dstCrsWkt ); region.SetGeoTransform( getGeoTransform( bbox, width, height ) ); gdal.ReprojectImage( src, region ); return region; }
this.gdalDataset = this.gdalDriver.Create(outputFile.toString(), imageWidth, imageHeight, bandCount, this.gdalDataType); if (this.gdalDataset == null) { throw new NullPointerException("Failed creating the file to export the product for driver '" + this.gdalDriver.getLongName() + "'.");