@Override public void getGeoPosInteger(int x0, int y0, GeoPos geoPos) { final int i = width * y0 + x0; final float lon0 = lonData[i]; final float lat0 = latData[i]; if (lat0 >= -90.0f && lat0 <= 90.0f && lon0 >= -180.0f && lon0 <= 180.0f) { geoPos.setLocation(lat0, lon0); } }
@Override protected GeoPos inverse_impl(float x, float y, GeoPos geoPoint) { final float cm = _centralMeridian; final double phi = y; final double lam = cm + x / Math.cos(phi); if (geoPoint == null) { geoPoint = new GeoPos(); } geoPoint.setLocation((float) Math.toDegrees(phi), (float) Math.toDegrees(lam)); return geoPoint; }
private void getGeoPosInternal(int pixelX, int pixelY, GeoPos geoPos) { if(pixelX >= 0 && pixelX < width && pixelY >= 0 && pixelY < height) { int i = pixelY*width + pixelX; if(lats[i] >= -90 && lats[i] <= 90 && lons[i] >= -180 && lons[i] <= 180) { geoPos.setLocation(lats[i], lons[i]); return; } } geoPos.setInvalid(); }
/** * Inverse project map co-ordinates into geographical co-ordinates. */ public GeoPos inverse(Point2D mapPoint, GeoPos geoPoint) { if (geoPoint != null) { geoPoint.setLocation((float) mapPoint.getY(), (float) mapPoint.getX()); } else { geoPoint = new GeoPos((float) mapPoint.getY(), (float) mapPoint.getX()); } return geoPoint; }
/** * {@inheritDoc} */ public GeoPos getGeoPos(final PixelPos pixelPos, GeoPos geoPos) { final Point2D point = forwardMap.getValue(pixelPos); rotator.transformInversely(point); if (geoPos == null) { geoPos = new GeoPos(); } geoPos.setLocation((float) point.getY(), (float) point.getX()); return geoPos; }
@Override public void getGeoPosInteger(int x0, int y0, GeoPos geoPos) { final float lon0 = getSampleFloat(x0, y0, lonImage, lonMaskImage); final float lat0 = getSampleFloat(x0, y0, latImage, latMaskImage); if (lat0 >= LAT_MIN && lat0 <= LAT_MAX && lon0 >= LON_MIN && lon0 <= LON_MAX) { geoPos.setLocation(lat0, lon0); } }
_tempY /= cosPhi; geoPoint.setLocation((float) (MathUtils.RTOD * _tempX), (float) (MathUtils.RTOD * _tempY)); return geoPoint;
geoPoint = new GeoPos(); geoPoint.setLocation((float) Math.toDegrees(phi), (float) Math.toDegrees(lam));
@Override public GeoPos getGeoPos(PixelPos pixelPos, GeoPos geoPos) { if (geoPos == null) { geoPos = new GeoPos(); } final float lat = 10.0f * (1 - pixelPos.y / OrthorectifierTest.SCENE_HEIGHT); final float lon = 10.0f * (pixelPos.x / OrthorectifierTest.SCENE_WIDTH); geoPos.setLocation(lat, lon); return geoPos; }
/** * Inverse project map co-ordinates into geographical co-ordinates. * * @param mapPoint the source location in x/y map coordinates * @param geoPoint the target position in lat/lon (might be null, then a new object is created) */ @Override public GeoPos inverse(Point2D mapPoint, GeoPos geoPoint) { if (geoPoint == null) { geoPoint = new GeoPos(); } geoPoint = inverse_impl((mapPoint.getX() - _x0) * _invA, (mapPoint.getY() - _y0) * _invA, geoPoint); geoPoint.setLocation(geoPoint.getLat(), geoPoint.getLon() + _centralMeridian); return geoPoint; }
while (!pathIterator.isDone()) { final int segmentType = pathIterator.currentSegment(floats); geoPos.setLocation(floats[1], floats[0]); if (segmentType == PathIterator.SEG_CLOSE) { pixelPath.closePath();
/** * Returns the latitude and longitude value for a given pixel co-ordinate. * * @param pixelPos the pixel's co-ordinates given as x,y * @param geoPos an instance of <code>GeoPos</code> to be used as retun value. If this parameter is * <code>null</code>, the method creates a new instance which it then returns. * * @return the geographical position as lat/lon. */ @Override public GeoPos getGeoPos(final PixelPos pixelPos, GeoPos geoPos) { if (geoPos == null) { geoPos = new GeoPos(0.0f, 0.0f); } final double x = _pixelOffsetX + _pixelSizeX * pixelPos.x; final double y = _pixelOffsetY + _pixelSizeY * pixelPos.y; final double lat = _latFunction.computeZ(x, y); final double lon = _lonFunction.computeZ(x, y); geoPos.setLocation((float) lat, (float) lon); return geoPos; }
private void getGeoPosInternal(int pixelX, int pixelY, GeoPos geoPos) { if (useTiling) { final int x = latLonImage.getMinX() + pixelX; final int y = latLonImage.getMinY() + pixelY; Raster data = latLonImage.getData(new Rectangle(x, y, 1, 1)); float lat = data.getSampleFloat(x, y, 0); float lon = data.getSampleFloat(x, y, 1); geoPos.setLocation(lat, lon); } else { int i = rasterWidth * pixelY + pixelX; final float lat = latGrid.getRasterData().getElemFloatAt(i); final float lon = lonGrid.getRasterData().getElemFloatAt(i); geoPos.setLocation(lat, lon); } }
GeoApproximation getGeoPos(PixelPos p, GeoPos g) { GeoApproximation approximation = null; if (approximations != null) { if (g == null) { g = new GeoPos(); } if (p.isValid()) { approximation = GeoApproximation.findSuitable(approximations, p); if (approximation != null) { final double x = p.getX(); final double y = p.getY(); final Point2D q = new Point2D.Double(x, y); approximation.p2g(q); final double lon = q.getX(); final double lat = q.getY(); if (lon >= -180.0 && lon <= 180.0 && lat >= -90.0 && lat <= 90.0) { g.setLocation((float) lat, (float) lon); } else { g.setInvalid(); } } else { g.setInvalid(); } } else { g.setInvalid(); } } return approximation; }
@Override public GeoPos getGeoPos(PixelPos pixelPos, GeoPos geoPos) { if (geoPos == null) { geoPos = new GeoPos(); } try { DirectPosition directPixelPos = new DirectPosition2D(pixelPos); DirectPosition directGeoPos = imageToGeo.transform(directPixelPos, null); geoPos.setLocation((float) directGeoPos.getOrdinate(1), (float) directGeoPos.getOrdinate(0)); } catch (Exception ignored) { geoPos.setInvalid(); } return geoPos; }
final float lat = interpolate(wx, wy, latLonData, 0); final float lon = interpolate(wx, wy, latLonData, 1); geoPos.setLocation(lat, lon); } else { getGeoPosInternal(x0, y0, geoPos);
float lat = MathUtils.interpolate2D(wx, wy, d00.lat, d10.lat, d01.lat, d11.lat); float lon = GeoCodingFactory.interpolateLon(wx, wy, d00.lon, d10.lon, d01.lon, d11.lon); geoPos.setLocation(lat, lon); return geoPos;
@Test @Ignore public void testGetPixelPosForSimulatedSwath() { final int nx = 512; final int ny = 36000; final PlanarImage[] images = generateSwathCoordinates(nx, ny, 0.009, 0.009, new Rotator(0.0, -5.0, 269.0)); final PlanarImage lonImage = images[0]; final PlanarImage latImage = images[1]; final PlanarImage maskImage = images[2]; final PixelPosEstimator estimator = new PixelPosEstimator(lonImage, latImage, maskImage, 0.5); final GeoPos g = new GeoPos(); final PixelPos p = new PixelPos(); for (int y = 0; y < ny; y++) { final Rectangle region = new Rectangle(0, y, nx, 1); final Raster lonData = lonImage.getData(region); final Raster latData = latImage.getData(region); for (int x = 0; x < nx; x++) { final float lon = lonData.getSampleFloat(x, y, 0); final float lat = latData.getSampleFloat(x, y, 0); g.setLocation(lat, lon); estimator.getPixelPos(g, p); assertTrue(p.isValid()); assertEquals(x + 0.5, p.getX(), 0.5); assertEquals(y + 0.5, p.getY(), 0.5); } } }