Exemple #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 - 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;
  }