示例#1
0
  protected Element genLonLatEnvelope(GridCoordSystem gcs) {
    // <CoverageOfferingBrief>/lonLatEnvelope
    Element lonLatEnvelopeElem = new Element("lonLatEnvelope", wcsNS);
    lonLatEnvelopeElem.setAttribute("srsName", "urn:ogc:def:crs:OGC:1.3:CRS84");

    LatLonRect llbb = gcs.getLatLonBoundingBox();
    LatLonPoint llpt = llbb.getLowerLeftPoint();
    LatLonPoint urpt = llbb.getUpperRightPoint();

    // <CoverageOfferingBrief>/lonLatEnvelope/gml:pos
    String firstPosition = llpt.getLongitude() + " " + llpt.getLatitude();
    double lon = llpt.getLongitude() + llbb.getWidth();
    String secondPosition = lon + " " + urpt.getLatitude();
    // ToDo WCS 1.0Plus - Deal with conversion to meters. (Yikes!!)
    CoordinateAxis1D vertAxis = gcs.getVerticalAxis();
    if (vertAxis != null) {
      // See verAxis.getUnitsString()
      double zeroIndexValue = vertAxis.getCoordValue(0);
      double sizeIndexValue = vertAxis.getCoordValue(((int) vertAxis.getSize()) - 1);
      if (vertAxis.getPositive().equals(ucar.nc2.constants.CF.POSITIVE_UP)) {
        firstPosition += " " + zeroIndexValue;
        secondPosition += " " + sizeIndexValue;
      } else {
        firstPosition += " " + sizeIndexValue;
        secondPosition += " " + zeroIndexValue;
      }
    }

    lonLatEnvelopeElem.addContent(new Element("pos", gmlNS).addContent(firstPosition));
    lonLatEnvelopeElem.addContent(new Element("pos", gmlNS).addContent(secondPosition));

    // <CoverageOfferingBrief>/lonLatEnvelope/gml:timePostion [2]
    if (gcs.hasTimeAxis()) {
      lonLatEnvelopeElem.addContent(
          new Element("timePosition", gmlNS)
              .addContent(gcs.getCalendarDateRange().getStart().toString()));
      lonLatEnvelopeElem.addContent(
          new Element("timePosition", gmlNS)
              .addContent(gcs.getCalendarDateRange().getEnd().toString()));
    }

    return lonLatEnvelopeElem;
  }
示例#2
0
  protected Element genLonLatEnvelope(GridCoordSystem gcs) {
    // <CoverageOfferingBrief>/lonLatEnvelope
    Element lonLatEnvelopeElem = new Element("lonLatEnvelope", wcsNS);
    lonLatEnvelopeElem.setAttribute("srsName", "urn:ogc:def:crs:OGC:1.3:CRS84");

    LatLonRect llbb = gcs.getLatLonBoundingBox();
    LatLonPoint llpt = llbb.getLowerLeftPoint();
    LatLonPoint urpt = llbb.getUpperRightPoint();

    // <CoverageOfferingBrief>/lonLatEnvelope/gml:pos
    String firstPosition = llpt.getLongitude() + " " + llpt.getLatitude();
    double lon = llpt.getLongitude() + llbb.getWidth();
    String secondPosition = lon + " " + urpt.getLatitude();
    // ToDo WCS 1.0Plus - Add vertical (Deal with conversion to meters. Yikes!!)
    //    CoordinateAxis1D vertAxis = gcs.getVerticalAxis();
    //    if ( vertAxis != null )
    //    {
    //      // See verAxis.getUnitsString()
    //      firstPosition += " " + vertAxis.getCoordValue( 0);
    //      secondPostion += " " + vertAxis.getCoordValue( ((int)vertAxis.getSize()) - 1);
    //    }

    lonLatEnvelopeElem.addContent(new Element("pos", gmlNS).addContent(firstPosition));
    lonLatEnvelopeElem.addContent(new Element("pos", gmlNS).addContent(secondPosition));

    // <CoverageOfferingBrief>/lonLatEnvelope/gml:timePostion [2]
    if (gcs.hasTimeAxis()) {
      DateRange dr = gcs.getDateRange();
      if (dr != null) {
        lonLatEnvelopeElem.addContent(
            new Element("timePosition", gmlNS).addContent(dr.getStart().toDateTimeStringISO()));
        lonLatEnvelopeElem.addContent(
            new Element("timePosition", gmlNS).addContent(dr.getEnd().toDateTimeStringISO()));
      }
    }

    return lonLatEnvelopeElem;
  }