本文整理了Java中org.gdal.gdal.gdal.Open()
方法的一些代码示例,展示了gdal.Open()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。gdal.Open()
方法的具体详情如下:
包路径:org.gdal.gdal.gdal
类名称:gdal
方法名:Open
暂无
代码示例来源:origin: it.geosolutions.imageio-ext/imageio-ext-gdalframework
/**
* Acquires a {@link Dataset} and return it, given the name of the Dataset
* source and the desired access type
*
* @param name
* of the dataset source to be accessed (usually, a File
* name).
* @param accessType
* @return the acquired {@link Dataset}
*/
public static Dataset acquireDataSet(final String name,final int accessType) {
if (!isGDALAvailable()) {
return null;
}
if(name == null) {
throw new IllegalArgumentException("Provided parameter is null:name");
}
return gdal.Open(name, accessType);
}
代码示例来源:origin: geosolutions-it/imageio-ext
/**
* Acquires a {@link Dataset} and return it, given the name of the Dataset
* source and the desired access type
*
* @param name
* of the dataset source to be accessed (usually, a File
* name).
* @param accessType
* @return the acquired {@link Dataset}
*/
public static Dataset acquireDataSet(final String name,final int accessType) {
if (!isGDALAvailable()) {
return null;
}
if(name == null) {
throw new IllegalArgumentException("Provided parameter is null:name");
}
return gdal.Open(name, accessType);
}
代码示例来源:origin: opengeospatial/geoapi
/**
* Opens a dataset for the given file in read-only mode.
*
* @param file the file to open.
* @throws IOException if the given file can not be opened.
*/
public DataSet(final Path file) throws IOException {
ds = gdal.Open(file.toString());
if (ds == null) {
String msg = gdal.GetLastErrorMsg();
if (msg == null) {
msg = "Can not open \"" + file + "\".";
}
throw new GDALException(msg);
}
}
代码示例来源:origin: com.revolsys.open/com.revolsys.open.gdal
public static Dataset getDataset(final File file, final int mode) {
if (isAvailable()) {
final String path = file.getAbsolutePath();
if (file.exists()) {
final Dataset dataset = gdal.Open(path, mode);
if (dataset == null) {
throw new GdalException();
} else {
final Resource resource = new FileSystemResource(file);
setProjectionFromPrjFile(dataset, resource);
final long modifiedTime = loadSettings(dataset, resource);
// loadAuxXmlFile(modifiedTime);
return dataset;
}
} else {
throw new IllegalArgumentException("File no found: " + path);
}
} else {
throw new IllegalStateException("GDAL is not available");
}
}
代码示例来源:origin: senbox-org/s2tbx
private ImageReader(Path inputFile, int bandIndex, int offsetX, int offsetY, int dataBufferType, int level) {
this.dataBufferType = dataBufferType;
this.level = level;
this.offsetX = offsetX;
this.offsetY = offsetY;
this.gdalDataset = gdal.Open(inputFile.toString(), gdalconst.GA_ReadOnly);
// bands are not 0-base indexed, so we must add 1
Band rasterBand = gdalDataset.GetRasterBand(bandIndex + 1);
if (level > 0 && rasterBand.GetOverviewCount() > 0) {
this.band = rasterBand.GetOverview(this.level - 1);
} else {
this.band = rasterBand;
}
}
代码示例来源:origin: deegree/deegree3
/**
* Creates a new {@link GdalDataset} from the given file (which must be supported by GDAL).
*
* @param file
* raster image file (format must be supported by GDAL), never <code>null</code>
* @param crs
* native CRS, can be <code>null</code> (unknown)
* @throws UnknownCRSException
* @throws IOException
*/
public GdalDataset( File file, ICRS crs ) throws UnknownCRSException, IOException {
this.file = file.getCanonicalFile();
this.crs = crs;
dataset = gdal.Open( file.getPath() );
datasetEnvelope = readEnvelope();
width = datasetEnvelope.getSpan0();
height = datasetEnvelope.getSpan1();
datasetPixelsX = dataset.getRasterXSize();
datasetPixelsY = dataset.getRasterYSize();
unitsPerPixelX = width / (double) datasetPixelsX;
unitsPerPixelY = height / (double) datasetPixelsY;
}
代码示例来源:origin: senbox-org/s2tbx
Dataset gdalDataset = gdal.Open(inputFile.toString(), gdalconst.GA_ReadOnly);
if (gdalDataset == null) {
内容来源于网络,如有侵权,请联系作者删除!