org.esa.snap.core.datamodel.GeoCoding.getGeoPos()方法的使用及代码示例

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

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

GeoCoding.getGeoPos介绍

暂无

代码示例

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

private GeoPos getCenterGeoPos(GeoCoding geoCoding, int width, int height) {
  final PixelPos centerPixelPos = new PixelPos(0.5 * width + 0.5,
      0.5 * height + 0.5);
  return geoCoding.getGeoPos(centerPixelPos, null);
}

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

private float[] getLatLon(int iX, int iY, Rectangle pixelWindow, Product sourceProduct) {
  float xOffset = ((iX + 0.5f) * pixelWindow.width + pixelWindow.x);
  float yOffset = ((iY + 0.5f) * pixelWindow.height + pixelWindow.y);
  GeoCoding geoCoding = sourceProduct.getSceneGeoCoding();
  GeoPos geoPos = geoCoding.getGeoPos(new PixelPos(xOffset, yOffset), null);
  return new float[]{(float) geoPos.lat, (float) geoPos.lon};
}

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

@Override
  protected double computeSample(int sourceX, int sourceY) {
    try {
      return dem.getElevation(geoCoding.getGeoPos(new PixelPos(sourceX, sourceY), null));
    } catch (Exception e) {
      return noDataValue;
    }
  }
}

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

private String getUTMZone() {
  GeoPos centerPos = srcProduct.getSceneGeoCoding().getGeoPos(new PixelPos(srcProduct.getSceneRasterWidth()/2, srcProduct.getSceneRasterHeight()/2), null);
  int zone = (int) Math.floor(centerPos.getLon()/6+31);
  return String.valueOf(zone);
}

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

private GeoPos getGeoPos(int x, int y) {
  final GeoPos geoPos = new GeoPos();
  final GeoCoding geoCoding = sourceProduct.getSceneGeoCoding();
  final PixelPos pixelPos = new PixelPos(x, y);
  geoCoding.getGeoPos(pixelPos, geoPos);
  return geoPos;
}

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

private double computeLongitude(Product product, String level){
  final GeoCoding sceneGeoCoding = product.getSceneGeoCoding();
  Double[] longitudePoints = {
      sceneGeoCoding.getGeoPos(new PixelPos(0, 0), null).getLon(),
      sceneGeoCoding.getGeoPos(new PixelPos(0, product.getSceneRasterHeight()), null).getLon(),
      sceneGeoCoding.getGeoPos(new PixelPos(product.getSceneRasterWidth(), 0), null).getLon(),
      sceneGeoCoding.getGeoPos(new PixelPos(product.getSceneRasterWidth(), product.getSceneRasterHeight()), null).getLon()
  };
  switch(level) {
    case PROPERTY_MIN_VALUE :
      return Collections.min(Arrays.asList(longitudePoints));
    case PROPERTY_MAX_VALUE :
      return Collections.max(Arrays.asList(longitudePoints));
    default :
      return Double.MAX_VALUE;
  }
}

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

private PixelPos getProductCenter(final Product product) {
  final GeoCoding geoCoding = product.getSceneGeoCoding();
  PixelPos centerPos = null;
  if (geoCoding != null) {
    final float pixelX = (float) Math.floor(0.5f * product.getSceneRasterWidth()) + 0.5f;
    final float pixelY = (float) Math.floor(0.5f * product.getSceneRasterHeight()) + 0.5f;
    final GeoPos geoPos = geoCoding.getGeoPos(new PixelPos(pixelX, pixelY), null);
    final AffineTransform transform = layerCanvas.getViewport().getModelToViewTransform();
    final Point2D point2D = transform.transform(new Point2D.Double(geoPos.getLon(), geoPos.getLat()), null);
    centerPos = new PixelPos((float) point2D.getX(), (float) point2D.getY());
  }
  return centerPos;
}

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

private double computeLatitude(Product product, String level){
  final GeoCoding sceneGeoCoding = product.getSceneGeoCoding();
  Double[] latitudePoints = {
            sceneGeoCoding.getGeoPos(new PixelPos(0, 0), null).getLat(),
            sceneGeoCoding.getGeoPos(new PixelPos(0, product.getSceneRasterHeight()), null).getLat(),
            sceneGeoCoding.getGeoPos(new PixelPos(product.getSceneRasterWidth(), 0), null).getLat(),
            sceneGeoCoding.getGeoPos(new PixelPos(product.getSceneRasterWidth(), product.getSceneRasterHeight()), null).getLat()
  };
  switch(level) {
    case PROPERTY_MIN_VALUE :
      return Collections.min(Arrays.asList(latitudePoints));
    case PROPERTY_MAX_VALUE :
      return Collections.max(Arrays.asList(latitudePoints));
    default :
      return Double.MAX_VALUE;
  }
}

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

private PixelPos getProductCenter(final Product product) {
  final GeoCoding geoCoding = product.getSceneGeoCoding();
  PixelPos centerPos = null;
  if (geoCoding != null) {
    final double pixelX = Math.floor(0.5f * product.getSceneRasterWidth()) + 0.5f;
    final double pixelY = Math.floor(0.5f * product.getSceneRasterHeight()) + 0.5f;
    final GeoPos geoPos = geoCoding.getGeoPos(new PixelPos(pixelX, pixelY), null);
    final AffineTransform transform = layerCanvas.getViewport().getModelToViewTransform();
    final Point2D point2D = transform.transform(new Point2D.Double(geoPos.getLon(), geoPos.getLat()), null);
    centerPos = new PixelPos(point2D.getX(), point2D.getY());
  }
  return centerPos;
}

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

double computeLatitude(Product product, String level){
  Double[] latitudePoints = {
            product.getSceneGeoCoding().getGeoPos(new PixelPos(0, 0), null).getLat(),
            product.getSceneGeoCoding().getGeoPos(new PixelPos(0, product.getSceneRasterHeight()), null).getLat(),
            product.getSceneGeoCoding().getGeoPos(new PixelPos(product.getSceneRasterWidth(), 0), null).getLat(),
            product.getSceneGeoCoding().getGeoPos(new PixelPos(product.getSceneRasterWidth(), product.getSceneRasterHeight()), null).getLat()
  };
  switch(level) {
    case PROPERTY_MIN_VALUE :
      return (double) Collections.min(Arrays.asList(latitudePoints));
    case PROPERTY_MAX_VALUE :
      return (double) Collections.max(Arrays.asList(latitudePoints));
    default :
      return Double.MAX_VALUE;
  }
}

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

private void writeCenterLatLon(final PrintStream p) {
  GeoPos geoPos = srcProduct.getSceneGeoCoding().getGeoPos(
      new PixelPos(srcProduct.getSceneRasterWidth() / 2, srcProduct.getSceneRasterHeight() / 2), null);
  p.println(GammaConstants.HEADER_KEY_CENTER_LATITUDE + sep + geoPos.getLat() + tab + "degrees");
  p.println(GammaConstants.HEADER_KEY_CENTER_LONGITUDE + sep + geoPos.getLon() + tab + "degrees");
  GeoPos geoPos2 = srcProduct.getSceneGeoCoding().getGeoPos(
      new PixelPos(srcProduct.getSceneRasterWidth() / 2, (srcProduct.getSceneRasterHeight() / 2) + 100), null);
  GeoUtils.DistanceHeading heading = GeoUtils.vincenty_inverse(geoPos, geoPos2);
  p.println(GammaConstants.HEADER_KEY_HEADING + sep + heading.heading1 + tab + "degrees");
}

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

double computeLongitude(Product product, String level){
  Double[] longitudePoints = {
      product.getSceneGeoCoding().getGeoPos(new PixelPos(0, 0), null).getLon(),
      product.getSceneGeoCoding().getGeoPos(new PixelPos(0, product.getSceneRasterHeight()), null).getLon(),
      product.getSceneGeoCoding().getGeoPos(new PixelPos(product.getSceneRasterWidth(), 0), null).getLon(),
      product.getSceneGeoCoding().getGeoPos(new PixelPos(product.getSceneRasterWidth(), product.getSceneRasterHeight()), null).getLon()
  };
  switch(level) {
    case PROPERTY_MIN_VALUE :
      return (double) Collections.min(Arrays.asList(longitudePoints));
    case PROPERTY_MAX_VALUE :
      return (double) Collections.max(Arrays.asList(longitudePoints));
    default :
      return Double.MAX_VALUE;
  }
}

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

@Override
protected void computePixel(int x, int y, Sample[] samples, WritableSample[] writableSamples) {
  final GeoPos geoPos = new GeoPos();
  sceneGeoCoding.getGeoPos(new PixelPos(x, y), geoPos);
  writableSamples[0].set(aerosolTypeProvider.getAerosolType(geoPos));
}

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

@Override
public void pixelPosChanged(ImageLayer baseImageLayer, int pixelX, int pixelY, int currentLevel,
              boolean pixelPosValid, MouseEvent e) {
  PixelPos pixelPos = computeLevelZeroPixelPos(baseImageLayer, pixelX, pixelY, currentLevel);
  GeoPos geoPos = view.getRaster().getGeoCoding().getGeoPos(pixelPos, null);
  updateCursorOverlays(geoPos, view);
}

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

public void updateDiagram(final ImageLayer imageLayer, final int pixelX, final int pixelY, final int level) {
  // get lat lons
  final GeoPos geoPos = product.getSceneGeoCoding().getGeoPos(new PixelPos(pixelX + 0.5f, pixelY + 0.5f), null);
  final DiagramGraph[] graphs = getGraphs();
  for (DiagramGraph graph : graphs) {
    ((TimeSeriesGraph) graph).readValues(imageLayer, geoPos, level);
  }
  adjustAxes(false);
  invalidate();
}

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

private void getCornerCoords() {
  GeoPos geoPos = srcProduct.getSceneGeoCoding().getGeoPos(new PixelPos(0, 0), null);
  LatLng latLng = new LatLng(geoPos.lat, geoPos.lon);
  UTMRef utm = latLng.toUTMRef();
  cornerNorth = utm.getNorthing();
  cornerEast = utm.getEasting();
}

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

private static void updateMetadata(final Product product) {
  final GeoCoding geoCoding = product.getSceneGeoCoding();
  if (geoCoding == null) return;
  final MetadataElement absRoot = AbstractMetadata.getAbstractedMetadata(product);
  final int w = product.getSceneRasterWidth();
  final int h = product.getSceneRasterHeight();
  final GeoPos geo00 = geoCoding.getGeoPos(new PixelPos(0, 0), null);
  AbstractMetadata.setAttribute(absRoot, AbstractMetadata.first_near_lat, geo00.getLat());
  AbstractMetadata.setAttribute(absRoot, AbstractMetadata.first_near_long, geo00.getLon());
  final GeoPos geo01 = geoCoding.getGeoPos(new PixelPos(w, 0), null);
  AbstractMetadata.setAttribute(absRoot, AbstractMetadata.first_far_lat, geo01.getLat());
  AbstractMetadata.setAttribute(absRoot, AbstractMetadata.first_far_long, geo01.getLon());
  final GeoPos geo10 = geoCoding.getGeoPos(new PixelPos(0, h), null);
  AbstractMetadata.setAttribute(absRoot, AbstractMetadata.last_near_lat, geo10.getLat());
  AbstractMetadata.setAttribute(absRoot, AbstractMetadata.last_near_long, geo10.getLon());
  final GeoPos geo11 = geoCoding.getGeoPos(new PixelPos(w, h), null);
  AbstractMetadata.setAttribute(absRoot, AbstractMetadata.last_far_lat, geo11.getLat());
  AbstractMetadata.setAttribute(absRoot, AbstractMetadata.last_far_long, geo11.getLon());
  //todo causes lazy tpg to load
  // ReaderUtils.addMetadataIncidenceAngles(product);
}

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

private static void setLatLonMetadata(final Product product, final MetadataElement absRoot) {
  final GeoCoding geoCoding = product.getSceneGeoCoding();
  if (geoCoding == null) return;
  final GeoPos geoPosFirstNear = product.getSceneGeoCoding().getGeoPos(new PixelPos(0, 0), null);
  final GeoPos geoPosFirstFar = product.getSceneGeoCoding().getGeoPos(new PixelPos(product.getSceneRasterWidth() - 1,
      0), null);
  final GeoPos geoPosLastNear = product.getSceneGeoCoding().getGeoPos(new PixelPos(0,
      product.getSceneRasterHeight() - 1), null);
  final GeoPos geoPosLastFar = product.getSceneGeoCoding().getGeoPos(new PixelPos(product.getSceneRasterWidth() - 1,
      product.getSceneRasterHeight() - 1), null);
  AbstractMetadata.setAttribute(absRoot, AbstractMetadata.first_near_lat, geoPosFirstNear.getLat());
  AbstractMetadata.setAttribute(absRoot, AbstractMetadata.first_near_long, geoPosFirstNear.getLon());
  AbstractMetadata.setAttribute(absRoot, AbstractMetadata.first_far_lat, geoPosFirstFar.getLat());
  AbstractMetadata.setAttribute(absRoot, AbstractMetadata.first_far_long, geoPosFirstFar.getLon());
  AbstractMetadata.setAttribute(absRoot, AbstractMetadata.last_near_lat, geoPosLastNear.getLat());
  AbstractMetadata.setAttribute(absRoot, AbstractMetadata.last_near_long, geoPosLastNear.getLon());
  AbstractMetadata.setAttribute(absRoot, AbstractMetadata.last_far_lat, geoPosLastFar.getLat());
  AbstractMetadata.setAttribute(absRoot, AbstractMetadata.last_far_long, geoPosLastFar.getLon());
}

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

protected void addCommonSARMetadata(final Product product) throws Exception {
  if(product.getSceneGeoCoding() == null) {
    return;
  }
  GeoPos geoPos = product.getSceneGeoCoding().getGeoPos(
      new PixelPos(product.getSceneRasterWidth() / 2, product.getSceneRasterHeight() / 2), null);
  GeoPos geoPos2 = product.getSceneGeoCoding().getGeoPos(
      new PixelPos(product.getSceneRasterWidth() / 2, (product.getSceneRasterHeight() / 2) + 100), null);
  GeoUtils.DistanceHeading heading = GeoUtils.vincenty_inverse(geoPos, geoPos2);
  final MetadataElement absRoot = AbstractMetadata.getAbstractedMetadata(product);
  AbstractMetadata.setAttribute(absRoot, "centre_lat", geoPos.getLat());
  AbstractMetadata.setAttribute(absRoot, "centre_lon", geoPos.getLon());
  AbstractMetadata.setAttribute(absRoot, "centre_heading", heading.heading1);
  AbstractMetadata.setAttribute(absRoot, "centre_heading2", heading.heading2);
}

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

private void gotoProduct(final Product product) {
  if (product == null) return;
  final View theView = getWwd().getView();
  final Position origPos = theView.getEyePosition();
  final GeoCoding geoCoding = product.getSceneGeoCoding();
  if (geoCoding != null && origPos != null) {
    final GeoPos centre = product.getSceneGeoCoding().getGeoPos(new PixelPos(product.getSceneRasterWidth() / 2,
                                      product.getSceneRasterHeight() / 2), null);
    centre.normalize();
    theView.setEyePosition(Position.fromDegrees(centre.getLat(), centre.getLon(), origPos.getElevation()));
  }
}

相关文章