use of org.opengis.metadata.Metadata in project sis by apache.
the class StoreTest method testFromInputStream.
/**
* Tests {@link StoreProvider#probeContent(StorageConnector)} followed by {@link Store#getMetadata()}
* reading from an {@link java.io.InputStream}. This method tests indirectly {@link StorageConnector}
* capability to reset the {@code InputStream} to its original position after {@code probeContent(…)}.
*
* @throws DataStoreException if en error occurred while reading the WKT.
*/
@Test
public void testFromInputStream() throws DataStoreException {
final Metadata metadata;
final StoreProvider p = new StoreProvider();
final StorageConnector c = new StorageConnector(new ByteArrayInputStream(StoreTest.WKT.getBytes(StandardCharsets.US_ASCII)));
assertTrue("isSupported", p.probeContent(c).isSupported());
try (Store store = new Store(null, c)) {
metadata = store.getMetadata();
assertSame("Expected cached value.", metadata, store.getMetadata());
}
validate((GeographicCRS) TestUtilities.getSingleton(metadata.getReferenceSystemInfo()));
}
use of org.opengis.metadata.Metadata in project sis by apache.
the class StoreTest method testMetadata.
/**
* Tests {@link Store#getMetadata()}.
*
* @throws DataStoreException if en error occurred while reading the XML.
*/
@Test
public void testMetadata() throws DataStoreException {
final Metadata metadata;
try (Store store = new Store(null, new StorageConnector(new StringReader(XML)))) {
metadata = store.getMetadata();
assertSame("Expected cached value.", metadata, store.getMetadata());
}
final ResponsibleParty resp = getSingleton(metadata.getContacts());
final Contact contact = resp.getContactInfo();
final OnlineResource resource = contact.getOnlineResource();
assertEquals(Locale.ENGLISH, metadata.getLanguage());
if (!REGRESSION)
assertEquals(CharacterSet.UTF_8, metadata.getCharacterSet());
assertEquals(Role.PRINCIPAL_INVESTIGATOR, resp.getRole());
assertEquals("Apache SIS", String.valueOf(resp.getOrganisationName()));
assertEquals("http://sis.apache.org", String.valueOf(resource.getLinkage()));
assertEquals(OnLineFunction.INFORMATION, resource.getFunction());
}
use of org.opengis.metadata.Metadata in project sis by apache.
the class StoreTest method testGetMetadata.
/**
* Tests {@link Store#getMetadata()}.
*
* @throws DataStoreException if an error occurred while parsing the data.
*/
@Test
public void testGetMetadata() throws DataStoreException {
final Metadata metadata;
try (Store store = open()) {
metadata = store.getMetadata();
}
final Extent extent = getSingleton(((AbstractIdentification) getSingleton(metadata.getIdentificationInfo())).getExtents());
final GeographicBoundingBox bbox = (GeographicBoundingBox) getSingleton(extent.getGeographicElements());
assertEquals("westBoundLongitude", 50.23, bbox.getWestBoundLongitude(), STRICT);
assertEquals("eastBoundLongitude", 50.31, bbox.getEastBoundLongitude(), STRICT);
assertEquals("southBoundLatitude", 9.23, bbox.getSouthBoundLatitude(), STRICT);
assertEquals("northBoundLatitude", 9.27, bbox.getNorthBoundLatitude(), STRICT);
assertTrue("Should not have a vertical extent.", extent.getVerticalElements().isEmpty());
}
use of org.opengis.metadata.Metadata in project sis by apache.
the class LandsatReaderTest method testRead.
/**
* Tests {@link LandsatReader#read(BufferedReader)}.
*
* <p><b>NOTE FOR MAINTAINER:</b> if the result of this test changes, consider updating
* <a href="./doc-files/LandsatMetadata.html">./doc-files/LandsatMetadata.html</a> accordingly.</p>
*
* @throws IOException if an error occurred while reading the test file.
* @throws DataStoreException if a property value can not be parsed as a number or a date.
* @throws FactoryException if an error occurred while creating the Coordinate Reference System.
*/
@Test
public void testRead() throws IOException, DataStoreException, FactoryException {
final Metadata actual;
try (BufferedReader in = new BufferedReader(new InputStreamReader(LandsatReaderTest.class.getResourceAsStream("LandsatTest.txt"), "UTF-8"))) {
final LandsatReader reader = new LandsatReader("LandsatTest.txt", new EmptyWarningListeners<>(Locale.ENGLISH, Modules.EARTH_OBSERVATION));
reader.read(in);
actual = reader.getMetadata();
}
final String text = formatNameAndValue(DefaultMetadata.castOrCopy(actual).asTreeTable());
assertMultilinesEquals("Metadata\n" + " ├─Metadata identifier……………………………………………………………… LandsatTest\n" + " ├─Metadata standard (1 of 2)…………………………………………… Geographic Information — Metadata Part 1: Fundamentals\n" + " │ ├─Edition…………………………………………………………………………………… ISO 19115-1:2014(E)\n" + " │ ├─Identifier…………………………………………………………………………… 19115-1\n" + " │ ├─Cited responsible party\n" + " │ │ ├─Role………………………………………………………………………………… Principal investigator\n" + " │ │ └─Party……………………………………………………………………………… International Organization for Standardization\n" + " │ └─Presentation form………………………………………………………… Document digital\n" + " ├─Metadata standard (2 of 2)…………………………………………… Geographic Information — Metadata Part 2: Extensions for imagery and gridded data\n" + " │ ├─Edition…………………………………………………………………………………… ISO 19115-2:2009(E)\n" + " │ ├─Identifier…………………………………………………………………………… 19115-2\n" + " │ ├─Cited responsible party\n" + " │ │ ├─Role………………………………………………………………………………… Principal investigator\n" + " │ │ └─Party……………………………………………………………………………… International Organization for Standardization\n" + " │ └─Presentation form………………………………………………………… Document digital\n" + " ├─Spatial representation info (1 of 2)\n" + " │ ├─Number of dimensions………………………………………………… 2\n" + " │ ├─Axis dimension properties (1 of 2)…………… Sample\n" + " │ │ └─Dimension size……………………………………………………… 15000\n" + " │ ├─Axis dimension properties (2 of 2)…………… Line\n" + " │ │ └─Dimension size……………………………………………………… 15500\n" + " │ ├─Transformation parameter availability…… false\n" + " │ └─Check point availability……………………………………… false\n" + " ├─Spatial representation info (2 of 2)\n" + " │ ├─Number of dimensions………………………………………………… 2\n" + " │ ├─Axis dimension properties (1 of 2)…………… Sample\n" + " │ │ └─Dimension size……………………………………………………… 7600\n" + " │ ├─Axis dimension properties (2 of 2)…………… Line\n" + " │ │ └─Dimension size……………………………………………………… 7800\n" + " │ ├─Transformation parameter availability…… false\n" + " │ └─Check point availability……………………………………… false\n" + " ├─Reference system info………………………………………………………… EPSG:WGS 84 / UTM zone 49N\n" + " ├─Identification info\n" + " │ ├─Citation………………………………………………………………………………… LandsatTest\n" + " │ │ └─Date………………………………………………………………………………… 2016-06-27 16:48:12\n" + " │ │ └─Date type………………………………………………………… Creation\n" + " │ ├─Credit……………………………………………………………………………………… Derived from U.S. Geological Survey data\n" + " │ ├─Spatial resolution (1 of 2)\n" + " │ │ └─Distance……………………………………………………………………… 15.0\n" + " │ ├─Spatial resolution (2 of 2)\n" + " │ │ └─Distance……………………………………………………………………… 30.0\n" + " │ ├─Extent\n" + " │ │ └─Geographic element\n" + " │ │ ├─West bound longitude…………………………… 108°20′24″E\n" + " │ │ ├─East bound longitude…………………………… 110°26′24″E\n" + " │ │ ├─South bound latitude…………………………… 10°30′N\n" + " │ │ ├─North bound latitude…………………………… 12°37′12″N\n" + " │ │ └─Extent type code……………………………………… true\n" + " │ └─Resource format\n" + " │ └─Format specification citation……………… GeoTIFF Coverage Encoding Profile\n" + " │ └─Alternate title………………………………………… GeoTIFF\n" + " ├─Content info\n" + " │ ├─Attribute group (1 of 3)\n" + " │ │ ├─Content type…………………………………………………………… Physical measurement\n" + " │ │ ├─Attribute (1 of 8)\n" + " │ │ │ ├─Description…………………………………………………… Coastal Aerosol\n" + " │ │ │ ├─Name……………………………………………………………………… TestImage_B1.TIF\n" + " │ │ │ ├─Max value………………………………………………………… 65535.0\n" + " │ │ │ ├─Min value………………………………………………………… 1.0\n" + " │ │ │ ├─Scale factor………………………………………………… 0.0127\n" + " │ │ │ ├─Offset………………………………………………………………… -63.6\n" + " │ │ │ ├─Bound units…………………………………………………… nm\n" + " │ │ │ ├─Peak response……………………………………………… 433.0\n" + " │ │ │ └─Transfer function type……………………… Linear\n" + " │ │ ├─Attribute (2 of 8)\n" + " │ │ │ ├─Description…………………………………………………… Blue\n" + " │ │ │ ├─Name……………………………………………………………………… TestImage_B2.TIF\n" + " │ │ │ ├─Max value………………………………………………………… 65535.0\n" + " │ │ │ ├─Min value………………………………………………………… 1.0\n" + " │ │ │ ├─Scale factor………………………………………………… 0.013\n" + " │ │ │ ├─Offset………………………………………………………………… -65.1\n" + " │ │ │ ├─Bound units…………………………………………………… nm\n" + " │ │ │ ├─Peak response……………………………………………… 482.0\n" + " │ │ │ └─Transfer function type……………………… Linear\n" + " │ │ ├─Attribute (3 of 8)\n" + " │ │ │ ├─Description…………………………………………………… Green\n" + " │ │ │ ├─Name……………………………………………………………………… TestImage_B3.TIF\n" + " │ │ │ ├─Max value………………………………………………………… 65535.0\n" + " │ │ │ ├─Min value………………………………………………………… 1.0\n" + " │ │ │ ├─Scale factor………………………………………………… 0.012\n" + " │ │ │ ├─Offset………………………………………………………………… -60.0\n" + " │ │ │ ├─Bound units…………………………………………………… nm\n" + " │ │ │ ├─Peak response……………………………………………… 562.0\n" + " │ │ │ └─Transfer function type……………………… Linear\n" + " │ │ ├─Attribute (4 of 8)\n" + " │ │ │ ├─Description…………………………………………………… Red\n" + " │ │ │ ├─Name……………………………………………………………………… TestImage_B4.TIF\n" + " │ │ │ ├─Max value………………………………………………………… 65535.0\n" + " │ │ │ ├─Min value………………………………………………………… 1.0\n" + " │ │ │ ├─Scale factor………………………………………………… 0.0101\n" + " │ │ │ ├─Offset………………………………………………………………… -50.6\n" + " │ │ │ ├─Bound units…………………………………………………… nm\n" + " │ │ │ ├─Peak response……………………………………………… 655.0\n" + " │ │ │ └─Transfer function type……………………… Linear\n" + " │ │ ├─Attribute (5 of 8)\n" + " │ │ │ ├─Description…………………………………………………… Near-Infrared\n" + " │ │ │ ├─Name……………………………………………………………………… TestImage_B5.TIF\n" + " │ │ │ ├─Max value………………………………………………………… 65535.0\n" + " │ │ │ ├─Min value………………………………………………………… 1.0\n" + " │ │ │ ├─Scale factor………………………………………………… 0.00619\n" + " │ │ │ ├─Offset………………………………………………………………… -31.0\n" + " │ │ │ ├─Bound units…………………………………………………… nm\n" + " │ │ │ ├─Peak response……………………………………………… 865.0\n" + " │ │ │ └─Transfer function type……………………… Linear\n" + " │ │ ├─Attribute (6 of 8)\n" + " │ │ │ ├─Description…………………………………………………… Short Wavelength Infrared (SWIR) 1\n" + " │ │ │ ├─Name……………………………………………………………………… TestImage_B6.TIF\n" + " │ │ │ ├─Max value………………………………………………………… 65535.0\n" + " │ │ │ ├─Min value………………………………………………………… 1.0\n" + " │ │ │ ├─Scale factor………………………………………………… 0.00154\n" + " │ │ │ ├─Offset………………………………………………………………… -7.7\n" + " │ │ │ ├─Bound units…………………………………………………… nm\n" + " │ │ │ ├─Peak response……………………………………………… 1610.0\n" + " │ │ │ └─Transfer function type……………………… Linear\n" + " │ │ ├─Attribute (7 of 8)\n" + " │ │ │ ├─Description…………………………………………………… Short Wavelength Infrared (SWIR) 2\n" + " │ │ │ ├─Name……………………………………………………………………… TestImage_B7.TIF\n" + " │ │ │ ├─Max value………………………………………………………… 65535.0\n" + " │ │ │ ├─Min value………………………………………………………… 1.0\n" + " │ │ │ ├─Scale factor………………………………………………… 5.19E-4\n" + " │ │ │ ├─Offset………………………………………………………………… -2.6\n" + " │ │ │ ├─Bound units…………………………………………………… nm\n" + " │ │ │ ├─Peak response……………………………………………… 2200.0\n" + " │ │ │ └─Transfer function type……………………… Linear\n" + " │ │ └─Attribute (8 of 8)\n" + " │ │ ├─Description…………………………………………………… Cirrus\n" + " │ │ ├─Name……………………………………………………………………… TestImage_B9.TIF\n" + " │ │ ├─Max value………………………………………………………… 65535.0\n" + " │ │ ├─Min value………………………………………………………… 1.0\n" + " │ │ ├─Scale factor………………………………………………… 0.00242\n" + " │ │ ├─Offset………………………………………………………………… -12.1\n" + " │ │ ├─Bound units…………………………………………………… nm\n" + " │ │ ├─Peak response……………………………………………… 1375.0\n" + " │ │ └─Transfer function type……………………… Linear\n" + " │ ├─Attribute group (2 of 3)\n" + " │ │ ├─Content type…………………………………………………………… Physical measurement\n" + " │ │ └─Attribute\n" + " │ │ ├─Description…………………………………………………… Panchromatic\n" + " │ │ ├─Name……………………………………………………………………… TestImage_B8.TIF\n" + " │ │ ├─Max value………………………………………………………… 65535.0\n" + " │ │ ├─Min value………………………………………………………… 1.0\n" + " │ │ ├─Scale factor………………………………………………… 0.0115\n" + " │ │ ├─Offset………………………………………………………………… -57.3\n" + " │ │ ├─Bound units…………………………………………………… nm\n" + " │ │ ├─Peak response……………………………………………… 590.0\n" + " │ │ └─Transfer function type……………………… Linear\n" + " │ ├─Attribute group (3 of 3)\n" + " │ │ ├─Content type…………………………………………………………… Physical measurement\n" + " │ │ ├─Attribute (1 of 2)\n" + " │ │ │ ├─Description…………………………………………………… Thermal Infrared Sensor (TIRS) 1\n" + " │ │ │ ├─Name……………………………………………………………………… TestImage_B10.TIF\n" + " │ │ │ ├─Max value………………………………………………………… 65535.0\n" + " │ │ │ ├─Min value………………………………………………………… 1.0\n" + " │ │ │ ├─Scale factor………………………………………………… 3.34E-4\n" + " │ │ │ ├─Offset………………………………………………………………… 0.1\n" + " │ │ │ ├─Bound units…………………………………………………… nm\n" + " │ │ │ ├─Peak response……………………………………………… 10800.0\n" + " │ │ │ └─Transfer function type……………………… Linear\n" + " │ │ └─Attribute (2 of 2)\n" + " │ │ ├─Description…………………………………………………… Thermal Infrared Sensor (TIRS) 2\n" + " │ │ ├─Name……………………………………………………………………… TestImage_B11.TIF\n" + " │ │ ├─Max value………………………………………………………… 65535.0\n" + " │ │ ├─Min value………………………………………………………… 1.0\n" + " │ │ ├─Scale factor………………………………………………… 3.34E-4\n" + " │ │ ├─Offset………………………………………………………………… 0.1\n" + " │ │ ├─Bound units…………………………………………………… nm\n" + " │ │ ├─Peak response……………………………………………… 12000.0\n" + " │ │ └─Transfer function type……………………… Linear\n" + " │ ├─Illumination elevation angle…………………………… 58.8\n" + " │ ├─Illumination azimuth angle………………………………… 116.9\n" + " │ └─Cloud cover percentage…………………………………………… 8.3\n" + " ├─Metadata scope\n" + " │ └─Resource scope………………………………………………………………… COVERAGE\n" + " ├─Acquisition information\n" + " │ ├─Acquisition requirement\n" + " │ │ └─Identifier………………………………………………………………… Software unit tests\n" + " │ ├─Operation\n" + " │ │ ├─Status…………………………………………………………………………… Completed\n" + " │ │ ├─Type………………………………………………………………………………… Real\n" + " │ │ └─Significant event\n" + " │ │ ├─Context……………………………………………………………… Acquisition\n" + " │ │ └─Time……………………………………………………………………… 2016-06-26 03:02:01\n" + " │ └─Platform\n" + " │ ├─Identifier………………………………………………………………… Pseudo LANDSAT\n" + " │ └─Instrument\n" + " │ └─Identifier……………………………………………………… Pseudo TIRS\n" + " ├─Date info………………………………………………………………………………………… 2016-06-27 16:48:12\n" + " │ └─Date type……………………………………………………………………………… Creation\n" + " └─Default locale+other locale………………………………………… en\n", text);
}
Aggregations