public void updatePixelUnit(CoordinateReferenceSystem crs) {
   final CoordinateSystem coordinateSystem = crs.getCoordinateSystem();
   final String unitX = coordinateSystem.getAxis(0).getUnit().toString();
   if (!unitX.equals(pixelXUnit.getText())) {
     pixelXUnit.setText(unitX);
     pixelSizeXField.setValue(unitMap.get(unitX));
   }
   final String unitY = coordinateSystem.getAxis(1).getUnit().toString();
   if (!unitY.equals(pixelYUnit.getText())) {
     pixelYUnit.setText(unitY);
     pixelSizeYField.setValue(unitMap.get(unitY));
   }
 }
    /**
     * Encodes the boundedBy element
     *
     * <p>e.g.:
     *
     * <pre>{@code
     * <gml:boundedBy>
     *    <gml:Envelope srsName="http://www.opengis.net/def/crs/EPSG/0/4326" axisLabels="Lat Long" uomLabels="deg deg" srsDimension="2">
     *       <gml:lowerCorner>1 1</gml:lowerCorner>
     *       <gml:upperCorner>5 3</gml:upperCorner>
     *    </gml:Envelope>
     * </gml:boundedBy>
     * }</pre>
     *
     * @param ci
     * @param gc2d
     * @param ePSGCode
     * @param axisSwap
     * @param srsName
     * @param axesNames
     * @param axisLabels
     * @throws IOException
     */
    public void handleBoundedBy(
        final GeneralEnvelope envelope,
        boolean axisSwap,
        String srsName,
        String axisLabels,
        WCSDimensionsHelper dimensionHelper)
        throws IOException {
      final CoordinateReferenceSystem crs = envelope.getCoordinateReferenceSystem();
      final CoordinateSystem cs = crs.getCoordinateSystem();

      // TODO time
      String uomLabels =
          extractUoM(crs, cs.getAxis(axisSwap ? 1 : 0).getUnit())
              + " "
              + extractUoM(crs, cs.getAxis(axisSwap ? 0 : 1).getUnit());

      // time and elevation dimensions management
      boolean hasElevation = false;
      boolean hasTime = false;
      if (dimensionHelper != null) {
        if (dimensionHelper.getElevationDimension() != null) {
          uomLabels = uomLabels + " m"; // TODO: Check elevation uom
          hasElevation = true;
        }
        if (dimensionHelper.getTimeDimension() != null) {
          uomLabels = uomLabels + " s";
          hasTime = true;
        }
      }
      final int srsDimension = cs.getDimension() + (hasElevation ? 1 : 0);

      // Setting up envelope bounds (including elevation)
      final String lower =
          new StringBuilder()
              .append(envelope.getLowerCorner().getOrdinate(axisSwap ? 1 : 0))
              .append(" ")
              .append(envelope.getLowerCorner().getOrdinate(axisSwap ? 0 : 1))
              .append(hasElevation ? " " + dimensionHelper.getBeginElevation() : "")
              .toString();

      final String upper =
          new StringBuilder()
              .append(envelope.getUpperCorner().getOrdinate(axisSwap ? 1 : 0))
              .append(" ")
              .append(envelope.getUpperCorner().getOrdinate(axisSwap ? 0 : 1))
              .append(hasElevation ? " " + dimensionHelper.getEndElevation() : "")
              .toString();

      // build the fragment
      final AttributesImpl envelopeAttrs = new AttributesImpl();
      envelopeAttrs.addAttribute("", "srsName", "srsName", "", srsName);
      envelopeAttrs.addAttribute("", "axisLabels", "axisLabels", "", axisLabels);
      envelopeAttrs.addAttribute("", "uomLabels", "uomLabels", "", uomLabels);
      envelopeAttrs.addAttribute(
          "", "srsDimension", "srsDimension", "", String.valueOf(srsDimension));
      start("gml:boundedBy");
      String envelopeName;
      if (dimensionHelper != null && (hasTime || hasElevation)) {
        envelopeName = "gml:EnvelopeWithTimePeriod";
      } else {
        envelopeName = "gml:Envelope";
      }
      start(envelopeName, envelopeAttrs);

      element("gml:lowerCorner", lower);
      element("gml:upperCorner", upper);

      if (dimensionHelper != null && hasTime) {
        element("gml:beginPosition", dimensionHelper.getBeginTime());
        element("gml:endPosition", dimensionHelper.getEndTime());
      }

      end(envelopeName);
      end("gml:boundedBy");
    }