I have Tiff file of population density in the world from Sadac.
I try to read this file in java and extract density number for specific point (LatLon). I tried opening and reading the file with Geotools, but i dont know, how to extract specific point and its fields (density). I tried many ways but none of them worked.
My code actualy:
File f = new File("/opt/gpw-v4-population-density_2020.tif");
AbstractGridFormat format = GridFormatFinder.findFormat(f);
AbstractGridCoverage2DReader reader = format.getReader(f);
CoordinateReferenceSystem crs = reader.getCoordinateReferenceSystem();
System.out.println(crs);
GridCoverage2D cov = null;
try {
cov = reader.read(null);
} catch (Exception e) {
//todo
}
Can anyone advise me how to get to the point and its fields? Thank you for advice.
Resolved.