org.gdal.gdal.gdal类的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(101)

本文整理了Java中org.gdal.gdal.gdal类的一些代码示例,展示了gdal类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。gdal类的具体详情如下:
包路径:org.gdal.gdal.gdal
类名称:gdal

gdal介绍

暂无

代码示例

代码示例来源:origin: it.geosolutions.imageio-ext/imageio-ext-gdalframework

public Driver initialValue() {
    return gdal.GetDriverByName("MEM");
  }
}

代码示例来源:origin: senbox-org/s2tbx

/**
   *  Init the drivers if the GDAL library is installed.
   */
  public static void initDrivers() {
    gdal.AllRegister(); // GDAL init drivers
  }
}

代码示例来源:origin: org.gdal/gdal

public java.nio.ByteBuffer ReadRaster_Direct(int xoff, int yoff, int xsize, int ysize,
                      int buf_xsize, int buf_ysize, int buf_type)
{
  long buf_size = buf_xsize * buf_ysize * (gdal.GetDataTypeSize(buf_type) / 8);
  if ((int)buf_size != buf_size)
      throw new OutOfMemoryError();
  java.nio.ByteBuffer nioBuffer = java.nio.ByteBuffer.allocateDirect((int)buf_size);
  int ret = ReadRaster_Direct(xoff, yoff, xsize, ysize, buf_xsize, buf_ysize, buf_type, nioBuffer);
  if (ret == gdalconstConstants.CE_None)
      return nioBuffer;
  else
      return null;
}

代码示例来源:origin: io.jeo/jeo-gdal

public static void init() throws Throwable {
  if (gdal.GetDriverCount() == 0) {
    gdal.AllRegister();
  }
}

代码示例来源:origin: com.revolsys.open/com.revolsys.open.gdal

public GdalException() {
 super(gdal.GetLastErrorMsg().trim());
 gdal.ErrorReset();
}

代码示例来源:origin: io.jeo/jeo-gdal

@Override
protected GDALDataset open(File file, Map<?, Object> opts) throws IOException {
  Dataset ds = gdal.OpenShared(file.getAbsolutePath());
  if (ds == null) {
    String lastErrMsg = gdal.GetLastErrorMsg();
    String msg = "Unable to open file: " + file;
    if (lastErrMsg != null) {
      msg += ", " + lastErrMsg;
    }
    throw new IOException(msg);
  }
  return new GDALDataset(file, ds, this);
}

代码示例来源:origin: it.geosolutions.imageio-ext/imageio-ext-gdalframework

final int threshold = getMaxMemorySizeForGDALMemoryDataset();
final int neededMemory = width * height * nBands
    * gdal.GetDataTypeSize(dataType) / 8;
  final Driver driver = gdal.GetDriverByName("GTiff");
  tempDs = driver.Create(tempFile, width, height, nBands, dataType,
      (String[])null);

代码示例来源:origin: geosolutions-it/imageio-ext

typeSizeInBytes = gdal.GetDataTypeSize(bufferType) / 8;
bufferSize = nBands * pixels * typeSizeInBytes;
        gdal.GetLastErrorMsg()).toString());
    LOGGER.info(new StringBuilder("Last error number: ").append(
        gdal.GetLastErrorNo()).toString());
    LOGGER.info(new StringBuilder("Last error type: ").append(
        gdal.GetLastErrorType()).toString());
    throw new RuntimeException(gdal.GetLastErrorMsg());

代码示例来源:origin: it.geosolutions.imageio-ext/imageio-ext-gdalframework

gdal.AllRegister();
final String versionInfo = gdal.VersionInfo("RELEASE_NAME");
if (versionInfo != null && versionInfo.trim().length() > 0) {
  if (LOGGER.isLoggable(Level.INFO))
final boolean showErrors = getAsBoolean(cplDebug);
if (!showErrors) {
  gdal.PushErrorHandler("CPLQuietErrorHandler");

代码示例来源: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: it.geosolutions.imageio-ext/imageio-ext-gdalframework

/**
 * Allows to enable/disable GDAL caching mechanism.
 * 
 * @param useCaching
 *                <code>true</code> to enable GDAL caching.
 *                <code>false</code> to disable GDAL caching.
 */
public static void setGdalCaching(boolean useCaching) {
  final String sOption = useCaching ? "YES" : "NO";
  gdal.SetConfigOption("GDAL_FORCE_CACHING", sOption);
}

代码示例来源: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: deegree/deegree3

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;
}

代码示例来源:origin: senbox-org/s2tbx

String gdalDataTypeName = gdal.GetDataTypeName(this.gdalDataType);
  String message = MessageFormat.format("The GDAL driver ''{0}'' does not support the data type ''{1}'' to create a new product." +
          " The available types are ''{2}''.",
this.gdalDriver = gdal.GetDriverByName(this.writerDriver.getDriverName());
if (this.gdalDriver == null) {
  throw new NullPointerException("The GDAL driver '" + this.writerDriver.getDriverDisplayName() + "' ("+this.writerDriver.getDriverName()+") used to write the product does not exist.");

代码示例来源:origin: senbox-org/s2tbx

Dataset gdalDataset = gdal.Open(inputFile.toString(), gdalconst.GA_ReadOnly);
if (gdalDataset == null) {
    String colorInterpretationName = gdal.GetColorInterpretationName(gdalBand.GetRasterColorInterpretation());
    bandComponentElement.setAttributeString("data type", gdal.GetDataTypeName(gdalDataType));
    bandComponentElement.setAttributeString("color interpretation", colorInterpretationName);
    bandComponentElement.setAttributeString("block size", tileWidth + "x" + tileHeight);

代码示例来源:origin: io.jeo/jeo-gdal

@Override
protected boolean canOpen(File file, Map<?, Object> opts, Messages msgs) {
  Driver drv = gdalDrv != null ? gdalDrv : gdal.IdentifyDriver(file.getAbsolutePath());
  if (drv == null) {
    String msg = "Unable to locate driver";
    String lastErrMsg = gdal.GetLastErrorMsg();
    if (lastErrMsg != null) {
      msg += ": " + lastErrMsg;
    }
    Messages.of(msgs).report(msg);
    return false;
  }
  return super.canOpen(file, opts, msgs);
}

代码示例来源:origin: org.geotools/gt-ogr-jni

@Override
public String GetLastErrorMsg() {
  return gdal.GetLastErrorMsg();
}

代码示例来源:origin: org.gdal/gdal

public static String[] GeneralCmdLineProcessor(String[] args)
{
  return GeneralCmdLineProcessor(args, 0);
}

代码示例来源:origin: senbox-org/s2tbx

/**
 * Check if the available creation data types of the driver contains the GDAL data type.
 *
 * @param gdalDataType  The GDAl data type to check
 *
 * @return              true if the driver can export the product containing the specified data type; false otherwise
 */
public boolean canExportProduct(int gdalDataType) {
  boolean allowedDataType = true;
  String gdalDataTypeName = gdal.GetDataTypeName(gdalDataType);
  if (this.creationDataTypes != null) {
    allowedDataType = this.creationDataTypes.contains(gdalDataTypeName);
  }
  return allowedDataType;
}

代码示例来源:origin: geosolutions-it/imageio-ext

dataset = gdal.AutoCreateWarpedVRT(
  dataset, 
  dataset.GetProjection(),

相关文章