Search in sources :

Example 1 with UnformattableObjectException

use of org.geotools.referencing.wkt.UnformattableObjectException in project s1tbx by senbox-org.

the class RangeDopplerGeocodingOpUI method updateParameters.

@Override
public void updateParameters() {
    OperatorUIUtils.updateParamList(bandList, paramMap, OperatorUIUtils.SOURCE_BAND_NAMES);
    final String properDEMName = (DEMFactory.getProperDEMName((String) demName.getSelectedItem()));
    paramMap.put("demName", properDEMName);
    paramMap.put("demResamplingMethod", demResamplingMethod.getSelectedItem());
    paramMap.put("imgResamplingMethod", imgResamplingMethod.getSelectedItem());
    paramMap.put("incidenceAngleForGamma0", incidenceAngleForGamma0.getSelectedItem());
    paramMap.put("incidenceAngleForSigma0", incidenceAngleForSigma0.getSelectedItem());
    if (pixelSpacingInMeter.getText().isEmpty()) {
        paramMap.put("pixelSpacingInMeter", 0.0);
    } else {
        paramMap.put("pixelSpacingInMeter", Double.parseDouble(pixelSpacingInMeter.getText()));
    }
    if (pixelSpacingInDegree.getText().isEmpty()) {
        paramMap.put("pixelSpacingInDegree", 0.0);
    } else {
        paramMap.put("pixelSpacingInDegree", Double.parseDouble(pixelSpacingInDegree.getText()));
    }
    if (properDEMName.equals(externalDEMStr)) {
        String extFileStr = externalDEMFile.getText();
        paramMap.put("externalDEMFile", new File(extFileStr));
        paramMap.put("externalDEMNoDataValue", Double.parseDouble(externalDEMNoDataValue.getText()));
        paramMap.put("externalDEMApplyEGM", externalDEMApplyEGM);
    }
    if (mapProjHandler.getCRS() != null) {
        final CoordinateReferenceSystem crs = mapProjHandler.getCRS();
        try {
            paramMap.put("mapProjection", crs.toWKT());
        } catch (UnformattableObjectException e) {
            // if too complex to convert using strict
            paramMap.put("mapProjection", crs.toString());
        }
    }
    paramMap.put("nodataValueAtSea", nodataValueAtSea);
    // paramMap.put("outputComplex", outputComplex);
    paramMap.put("saveDEM", saveDEM);
    paramMap.put("saveLatLon", saveLatLon);
    paramMap.put("saveIncidenceAngleFromEllipsoid", saveIncidenceAngleFromEllipsoid);
    paramMap.put("saveLocalIncidenceAngle", saveLocalIncidenceAngle);
    paramMap.put("saveProjectedLocalIncidenceAngle", saveProjectedLocalIncidenceAngle);
    paramMap.put("saveSelectedSourceBand", saveSelectedSourceBand);
    paramMap.put("saveLayoverShadowMask", saveLayoverShadowMask);
    paramMap.put("applyRadiometricNormalization", applyRadiometricNormalization);
    paramMap.put("saveBetaNought", saveBetaNought);
    paramMap.put("saveGammaNought", saveGammaNought);
    paramMap.put("saveSigmaNought", saveSigmaNought);
    paramMap.put("auxFile", auxFile.getSelectedItem());
    final String extAuxFileStr = externalAuxFile.getText();
    if (!extAuxFileStr.isEmpty()) {
        paramMap.put("externalAuxFile", new File(extAuxFileStr));
    }
}
Also used : UnformattableObjectException(org.geotools.referencing.wkt.UnformattableObjectException) CoordinateReferenceSystem(org.opengis.referencing.crs.CoordinateReferenceSystem) File(java.io.File)

Example 2 with UnformattableObjectException

use of org.geotools.referencing.wkt.UnformattableObjectException in project s1tbx by senbox-org.

the class MosaicOp method createCRSGeoCoding.

private CrsGeoCoding createCRSGeoCoding(final Product srcGeoCodingProduct, final GeoCoding srcGeocoding) throws Exception {
    final CoordinateReferenceSystem srcCRS = srcGeocoding.getMapCRS();
    String wkt;
    try {
        wkt = srcCRS.toWKT();
    } catch (UnformattableObjectException e) {
        // if too complex to convert using strict
        wkt = srcCRS.toString();
    }
    final CoordinateReferenceSystem targetCRS = CRSGeoCodingHandler.getCRS(srcGeoCodingProduct, wkt);
    final double pixelSpacingInDegree = pixelSize / Constants.semiMajorAxis * Constants.RTOD;
    double pixelSizeX = pixelSize;
    double pixelSizeY = pixelSize;
    if (targetCRS.getName().getCode().equals("WGS84(DD)") || CRSGeoCodingHandler.isDegree(targetCRS.getCoordinateSystem().getAxis(0).getUnit())) {
        pixelSizeX = pixelSpacingInDegree;
        pixelSizeY = pixelSpacingInDegree;
    }
    final Rectangle2D bounds = new Rectangle2D.Double();
    bounds.setFrameFromDiagonal(scnProp.lonMin, scnProp.latMin, scnProp.lonMax, scnProp.latMax);
    final ReferencedEnvelope boundsEnvelope = new ReferencedEnvelope(bounds, DefaultGeographicCRS.WGS84);
    final ReferencedEnvelope targetEnvelope = boundsEnvelope.transform(targetCRS, true);
    return new CrsGeoCoding(targetCRS, sceneWidth, sceneHeight, targetEnvelope.getMinimum(0), targetEnvelope.getMaximum(1), pixelSizeX, pixelSizeY);
}
Also used : ReferencedEnvelope(org.geotools.geometry.jts.ReferencedEnvelope) UnformattableObjectException(org.geotools.referencing.wkt.UnformattableObjectException) Rectangle2D(java.awt.geom.Rectangle2D) CoordinateReferenceSystem(org.opengis.referencing.crs.CoordinateReferenceSystem)

Example 3 with UnformattableObjectException

use of org.geotools.referencing.wkt.UnformattableObjectException in project s1tbx by senbox-org.

the class GeolocationGridGeocodingOpUI method updateParameters.

@Override
public void updateParameters() {
    OperatorUIUtils.updateParamList(bandList, paramMap, OperatorUIUtils.SOURCE_BAND_NAMES);
    paramMap.put("imgResamplingMethod", imgResamplingMethod.getSelectedItem());
    if (mapProjHandler.getCRS() != null) {
        final CoordinateReferenceSystem crs = mapProjHandler.getCRS();
        try {
            paramMap.put("mapProjection", crs.toWKT());
        } catch (UnformattableObjectException e) {
            // if too complex to convert using strict
            paramMap.put("mapProjection", crs.toString());
        }
    }
}
Also used : UnformattableObjectException(org.geotools.referencing.wkt.UnformattableObjectException) CoordinateReferenceSystem(org.opengis.referencing.crs.CoordinateReferenceSystem)

Aggregations

UnformattableObjectException (org.geotools.referencing.wkt.UnformattableObjectException)3 CoordinateReferenceSystem (org.opengis.referencing.crs.CoordinateReferenceSystem)3 Rectangle2D (java.awt.geom.Rectangle2D)1 File (java.io.File)1 ReferencedEnvelope (org.geotools.geometry.jts.ReferencedEnvelope)1