LandsatLevel2Metadata extends XmlMetadata { public Point2D.Double getUpperLeft() { MetadataElement[] metadataElements = getRootElement().getElement("global_metadata").getElement("projection_information").getElements(); for (MetadataElement corner_point : metadataElements) { if(!corner_point.getName().equals("corner_point")) { continue; } if(corner_point.getAttribute("location").getData().toString().equals("UL")) { double x = Double.parseDouble(corner_point.getAttribute("x").getData().toString()); double y = Double.parseDouble(corner_point.getAttribute("y").getData().toString()); return new Point2D.Double(x, y); } } return null; } LandsatLevel2Metadata(String name); @Override String getFileName(); @Override String getProductName(); String getProductDescription(); @Override String getFormatName(); @Override String getMetadataProfile(); @Override int getRasterWidth(); @Override int getRasterHeight(); @Override String[] getRasterFileNames(); @Override ProductData.UTC getProductStartTime(); @Override ProductData.UTC getProductEndTime(); @Override ProductData.UTC getCenterTime(); @Override int getNumBands(); Point2D.Double getUpperLeft(); String getBandName(String filename); double getScalingFactor(String filename); double getScalingOffset(String filename); float getWavelength(String filename); float getBandwidth(String filename); String getBandDescription(String filename); boolean isReflectanceBand(String filename); boolean isSaturationBand(String filename); boolean isAerosolBand(String filename); boolean isQualityBand(String filename); boolean isAtmosBand(String filename); boolean isCloudBand(String filename); String getSatellite(); String getInstrument(); FlagCoding createSaturationFlagCoding(String bandName);  }
@Test public void testUpperLeft() throws Exception { Point2D.Double upperLeft = metadata.getUpperLeft(); assertNotNull(upperLeft); assertEquals(upperLeft.x,473400,0.1); assertEquals(upperLeft.y,3946500,0.1); }