/** * Compute DEM traversal step sizes (in degree) in latitude and longitude. * * @throws Exception The exceptions. */ private void computeDEMTraversalSampleInterval() throws Exception { double[] latLonMinMax = new double[4]; computeImageGeoBoundary(0, sourceImageWidth - 1, 0, sourceImageHeight - 1, latLonMinMax); final double groundRangeSpacing = SARGeocoding.getRangePixelSpacing(sourceProduct); final double azimuthPixelSpacing = SARGeocoding.getAzimuthPixelSpacing(sourceProduct); final double spacing = Math.min(groundRangeSpacing, azimuthPixelSpacing); // final double spacing = (groundRangeSpacing + azimuthPixelSpacing)/2.0; final double latMin = latLonMinMax[0]; final double latMax = latLonMinMax[1]; double minAbsLat; if (latMin * latMax > 0) { minAbsLat = Math.min(Math.abs(latMin), Math.abs(latMax)) * Constants.DTOR; } else { minAbsLat = 0.0; } delLat = spacing / Constants.MeanEarthRadius * Constants.RTOD; delLon = spacing / (Constants.MeanEarthRadius * FastMath.cos(minAbsLat)) * Constants.RTOD; delLat = Math.min(delLat, delLon); // (delLat + delLon)/2.0; delLon = delLat; }