org.esa.beam.framework.datamodel.GeoCoding.getImageToMapTransform()方法的使用及代码示例

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

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

GeoCoding.getImageToMapTransform介绍

暂无

代码示例

代码示例来源:origin: bcdev/beam

public static AffineTransform getImageToModelTransform(GeoCoding geoCoding) {
  if (geoCoding == null) {
    return new AffineTransform();
  }
  final MathTransform image2Map = geoCoding.getImageToMapTransform();
  if (image2Map instanceof AffineTransform) {
    return new AffineTransform((AffineTransform) image2Map);
  }
  return new AffineTransform();
}

代码示例来源:origin: bcdev/beam

/**
 * Gets the coordinate reference system used for the model space. The model space is coordinate system
 * that is used to render images for display.
 *
 * @param geoCoding A geo-coding, may be {@code null}.
 * @return The coordinate reference system used for the model space. If {@code geoCoding} is {@code null},
 *         it will be a default image coordinate reference system (an instance of {@code org.opengis.referencing.crs.ImageCRS}).
 */
public static CoordinateReferenceSystem getModelCrs(GeoCoding geoCoding) {
  if (geoCoding != null) {
    final MathTransform image2Map = geoCoding.getImageToMapTransform();
    if (image2Map instanceof AffineTransform) {
      return geoCoding.getMapCRS();
    }
    return geoCoding.getImageCRS();
  } else {
    return DEFAULT_IMAGE_CRS;
  }
}

代码示例来源:origin: bcdev/beam

public static GeoTIFFMetadata createGeoTIFFMetadata(GeoCoding geoCoding, int width, int height) {
  GeoTIFFMetadata metadata = null;
  if (geoCoding instanceof CrsGeoCoding || geoCoding instanceof MapGeoCoding) {
    metadata = createProjectedGeoTIFFMetadata(geoCoding.getMapCRS(), geoCoding.getImageToMapTransform());
  } else if (geoCoding != null) {
    metadata = createFallbackGeoTIFFMetada(geoCoding, width, height);
  }
  return metadata;
}

代码示例来源:origin: bcdev/beam

private void addWktAsVariable(NFileWriteable ncFile, GeoCoding geoCoding) throws IOException {
    final CoordinateReferenceSystem crs = geoCoding.getMapCRS();
    final double[] matrix = new double[6];
    final MathTransform transform = geoCoding.getImageToMapTransform();
    if (transform instanceof AffineTransform) {
      ((AffineTransform) transform).getMatrix(matrix);
    }
    final NVariable crsVariable = ncFile.addScalarVariable("crs", DataType.INT);
    crsVariable.addAttribute("wkt", crs.toWKT());
    crsVariable.addAttribute("i2m", StringUtils.arrayToCsv(matrix));
  }
}

代码示例来源:origin: bcdev/beam

private static FeatureCollection<SimpleFeatureType, SimpleFeature> transformPixelPosToGeoPos(FeatureCollection<SimpleFeatureType, SimpleFeature> fc, GeoCoding geoCoding) {
    Iterator<SimpleFeature> iterator = fc.iterator();
    FeatureCollection<SimpleFeatureType, SimpleFeature> transformedFc = new DefaultFeatureCollection(fc.getID(), fc.getSchema());
    while (iterator.hasNext()) {
      SimpleFeature sourceFeature = iterator.next();
      Geometry geometry = (Geometry) sourceFeature.getDefaultGeometry();
      GeometryCoordinateSequenceTransformer transformer = new GeometryCoordinateSequenceTransformer();
      transformer.setMathTransform(geoCoding.getImageToMapTransform());
      transformer.setCoordinateReferenceSystem(geoCoding.getMapCRS());
      try {
        geometry = transformer.transform(geometry);
      } catch (TransformException e) {
        throw new IllegalStateException(e);
      }
      sourceFeature.setDefaultGeometry(geometry);
      transformedFc.add(sourceFeature);
    }
    return transformedFc;
  }
}

代码示例来源:origin: bcdev/beam

tmy = String.valueOf(MathUtils.round(mapPoint.getY(), 10000.0));
} else if (geoCoding instanceof CrsGeoCoding) {
  MathTransform transform = geoCoding.getImageToMapTransform();
  try {
    DirectPosition position = transform.transform(new DirectPosition2D(pX, pY), null);

相关文章