I would like to read raster from PostGIS. I can do it from files on disk, but I'm having difficulties to find examples reading from PostGIS. What do I have to change to set up the reader from files to PostGIS? This is how I do it with files:
file= new File(filepath);
}
MainDialog.lastInputDir = file;
AbstractGridFormat format = GridFormatFinder.findFormat(file);
Hints hints = new Hints();
if (format instanceof GeoTiffFormat) {
hints = new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE);
}
try {
reader = format.getReader(file, hints);
Style rasterStyle = null;
GridCoverage2D cov = null;
try {
cov = reader.read(null);
} catch (IOException giveUp) {
throw new RuntimeException(giveUp);
}