use of org.gdal.gdal.Dataset in project com.revolsys.open by revolsys.
the class Gdal method getDataset.
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 PathResource(file);
setProjectionFromPrjFile(dataset, resource);
final long modifiedTime = loadSettings(dataset, resource);
return dataset;
}
} else {
throw new IllegalArgumentException("File no found: " + path);
}
} else {
throw new IllegalStateException("GDAL is not available");
}
}
Aggregations