Java Code Examples for ucar.unidata.geoloc.LatLonRect#getWidth()
The following examples show how to use
ucar.unidata.geoloc.LatLonRect#getWidth() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ThreddsMetadata.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 5 votes |
public void setBoundingBox(LatLonRect bb) { LatLonPointImpl llpt = bb.getLowerLeftPoint(); LatLonPointImpl urpt = bb.getUpperRightPoint(); double height = urpt.getLatitude() - llpt.getLatitude(); this.eastwest = new Range(llpt.getLongitude(), bb.getWidth(), 0.0, CDM.LON_UNITS); this.northsouth = new Range(llpt.getLatitude(), height, 0.0, CDM.LAT_UNITS); if ((bb.getWidth() > 358) && (height > 178)) setGlobal(true); // LOOK ?? }
Example 2
Source File: WcsRequest.java From tds with BSD 3-Clause "New" or "Revised" License | 5 votes |
protected Element genLonLatEnvelope(CoverageCollection gcd, CoverageCoordSys gcs) { // <CoverageOfferingBrief>/lonLatEnvelope Element lonLatEnvelopeElem = new Element("lonLatEnvelope", wcsNS); lonLatEnvelopeElem.setAttribute("srsName", "urn:ogc:def:crs:OGC:1.3:CRS84"); LatLonRect llbb = gcd.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] CoverageCoordAxis timeCoord = gcs.getTimeAxis(); if (timeCoord != null) { CalendarDateRange dr = timeCoord.getDateRange(); if (dr != null) { lonLatEnvelopeElem.addContent(new Element("timePosition", gmlNS).addContent(dr.getStart().toString())); lonLatEnvelopeElem.addContent(new Element("timePosition", gmlNS).addContent(dr.getEnd().toString())); } } return lonLatEnvelopeElem; }
Example 3
Source File: ThreddsMetadata.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 4 votes |
public GeospatialCoverage(LatLonRect bb, CoordinateAxis1D vaxis, double dX, double dY) { if (bb == null) { this.eastwest = null; this.northsouth = null; this.isGlobal = false; this.names = null; } else { LatLonPoint llpt = bb.getLowerLeftPoint(); LatLonPoint urpt = bb.getUpperRightPoint(); double height = urpt.getLatitude() - llpt.getLatitude(); this.eastwest = new GeospatialRange(llpt.getLongitude(), bb.getWidth(), dX, CDM.LON_UNITS); this.northsouth = new GeospatialRange(llpt.getLatitude(), height, dY, CDM.LAT_UNITS); if ((bb.getWidth() >= (360 - dX)) && (height >= (180 - dY))) { this.isGlobal = true; // serialize isGlobal this.names = new ArrayList<>(); this.names.add(new Vocab("global", null)); } else { this.isGlobal = false; this.names = null; } } if (vaxis == null) { this.updown = null; this.zpositive = null; } else { int n = (int) vaxis.getSize(); double size = vaxis.getCoordValue(n - 1) - vaxis.getCoordValue(0); double resolution = vaxis.getIncrement(); String units = vaxis.getUnitsString(); this.updown = new GeospatialRange(vaxis.getCoordValue(0), size, resolution, units); if (units != null) { boolean isPositive = SimpleUnit.isCompatible("m", units); this.zpositive = isPositive ? CF.POSITIVE_UP : CF.POSITIVE_DOWN; } else { this.zpositive = CF.POSITIVE_UP; } } }