@Override public GeoPos getGeoPos(PixelPos pixelPos, GeoPos geoPos) { Point2D point2D = affineTransform.transform(pixelPos, null); if (geoPos == null) { geoPos = new GeoPos(); } geoPos.lon = point2D.getX(); geoPos.lat = point2D.getY(); return geoPos; }
GeoPos geoPos = geoCoding.getGeoPos(pixelPos, null); if (showGeoPosOffsetDecimals) { geoPosLabel.setText(String.format("Lat %.5f Lon %.5f", geoPos.getLat(), geoPos.getLon())); } else { geoPosLabel.setText(String.format(GEO_POS_FORMAT, geoPos.getLatString(), geoPos.getLonString()));
public GeoPos[] getSelectionBox() { final GeoPos[] selectionBox = new GeoPos[5]; selectionBox[0] = selectionBoxStart; selectionBox[1] = new GeoPos(selectionBoxStart.getLat(), selectionBoxEnd.getLon()); selectionBox[2] = selectionBoxEnd; selectionBox[3] = new GeoPos(selectionBoxEnd.getLat(), selectionBoxStart.getLon()); selectionBox[4] = selectionBoxStart; return selectionBox; }
void setCenterPos(GeoPos geoPos) { if (geoPos != null) { centerLatLabel.setText(geoPos.getLatString()); centerLonLabel.setText(geoPos.getLonString()); } else { centerLatLabel.setText(""); centerLonLabel.setText(""); } }
final GeoPos geoPos = new GeoPos(); if (geoCoding.canGetGeoPos()) { final PixelPos pixelPos = new PixelPos(imagePosX, imagePosY); geoCoding.getGeoPos(pixelPos, geoPos); } else { geoPos.setInvalid(); new ComputedData(imagePosX, imagePosY, (float) geoPos.getLat(), (float) geoPos.getLon(), (float) rasterMean, (float) rasterSigma, correlativeData, featureProperties));
private void syncLatLonWithXYParams() { final PixelPos pixelPos1 = new PixelPos(((Number) paramX1.getValue()).intValue(), ((Number) paramY1.getValue()).intValue()); final PixelPos pixelPos2 = new PixelPos(((Number) paramX2.getValue()).intValue(), ((Number) paramY2.getValue()).intValue()); final GeoCoding geoCoding = product.getSceneGeoCoding(); final GeoPos geoPos1 = geoCoding.getGeoPos(pixelPos1, null); final GeoPos geoPos2 = geoCoding.getGeoPos(pixelPos2, null); if(geoPos1.isValid()) { double lat = geoPos1.getLat(); lat = MathUtils.crop(lat, -90.0, 90.0); paramNorthLat1.setValue(lat, null); double lon = geoPos1.getLon(); lon = MathUtils.crop(lon, -180.0, 180.0); paramWestLon1.setValue(lon, null); } if (geoPos2.isValid()) { double lat = geoPos2.getLat(); lat = MathUtils.crop(lat, -90.0, 90.0); paramSouthLat2.setValue(lat, null); double lon = geoPos2.getLon(); lon = MathUtils.crop(lon, -180.0, 180.0); paramEastLon2.setValue(lon, null); } }
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())); } }
final PixelPos sceneLowerRight, final String nodeType) { if (geoCoding != null) { GeoPos gp = new GeoPos(); addRow("Center latitude", gp.getLatString()); addRow("Center longitude", gp.getLonString()); addRow("Upper left latitude", gp.getLatString()); addRow("Upper left longitude", gp.getLonString()); addRow("Upper right latitude", gp.getLatString()); addRow("Upper right longitude", gp.getLonString()); addRow("Lower left latitude", gp.getLatString()); addRow("Lower left longitude", gp.getLonString()); addRow("Lower right latitude", gp.getLatString()); addRow("Lower right longitude", gp.getLonString());
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); }
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; } }
pixelCorners[0] = dem.getIndex(new GeoPos(geoCorners[0].lat, geoCorners[0].lon)); pixelCorners[1] = dem.getIndex(new GeoPos(geoCorners[1].lat, geoCorners[1].lon)); pixelCorners[0] = dem.getIndex(new GeoPos(geoCorners[0].lat, geoCorners[0].lon)); pixelCorners[1] = dem.getIndex(new GeoPos(geoCorners[1].lat, geoCorners[1].lon)); int nLonPixels = (int) Math.abs(pixelCorners[1].x - pixelCorners[0].x); if(!upperLeftGeo.isValid()) { return null;
private double getElevation(final int x, final int y) throws Exception { final GeoPos geoPos = new GeoPos(); double alt; geoPos.setLocation(latitudeTPG.getPixelDouble(x, y), longitudeTPG.getPixelDouble(x, y)); if (externalDEMFile == null) { alt = dem.getElevation(geoPos); } else { alt = fileElevationModel.getElevation(geoPos); } return alt; }
/** * Returns the rotation angle of otherCell relative to the current cell. * @param otherCell The second cell to get the rotation from. * @return The angle value (radians) */ public double rotation(BandMatrixCell otherCell) { Assert.notNull(otherCell); Assert.notNull(otherCell.band); double angle = 0.0; GeoCoding otherGeoCoding = otherCell.band.getGeoCoding(); if (otherGeoCoding != null) { GeoPos brCorner = new GeoPos(); otherGeoCoding.getGeoPos(new PixelPos(otherCell.band.getRasterWidth() - 1, otherCell.band.getRasterHeight() - 1), brCorner); angle = (brCorner.getLat() - otherCell.origin.getY()) / (brCorner.getLon() - otherCell.origin.getX()); } return angle; } }
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; } }
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; } }
final GeoPos geoPos = new GeoPos(); final double mstWidth = masterProduct.getSceneRasterWidth(); final double mstHeight = masterProduct.getSceneRasterHeight(); for (Coordinate c : tgtGeometry.getCoordinates()) { geoPos.setLocation(c.y, c.x); mstGeoCoding.getPixelPos(geoPos, pixPos);
void setCenterPos(GeoPos geoPos) { if (geoPos != null) { centerLatLabel.setText(geoPos.getLatString()); centerLonLabel.setText(geoPos.getLonString()); } else { centerLatLabel.setText(""); centerLonLabel.setText(""); } }