Hi GeoTools people, I have a pipeline for data from geostationary satellites which involves the following:
- use GDAL to reproject the data from its native, geostationary projection to a cylindrical projection - use GDAL to arrange the data into a cloud optimised GeoTIFF - use a GeoTools based server to render imagery from the COG to clients The reason for reprojecting is that I've never been able to get GeoTools to transform from the geostationary projections. A basic geographic projection is fine in cases where the satellite is centred nearer to 0°E but when its field of view encompasses the dateline it's helpful to use an equidistant cylindrical projection that's centred on the same longitude as the satellite. That avoids dealing with an image which spans from 180°W to 180°E and comprises mostly "nodata" pixels (with the data at the left and right edges). When rendering the latter images using GeoTools, though, I get a band of missing data near the dateline. I'm wondering whether anybody can see where I'm going wrong. To reproduce: The following is an image produced from Himawari-8's visible red band, in the native geostationary projection. https://anero.id/geotools-202003/himawari-8-visible.tif Here it is after reprojecting to +proj=eqc +lon_0=140.7 +ellps=WGS84 using GDAL. https://anero.id/geotools-202003/himawari-8-visible-eqc.tif And here's the image from GeoTools, rendered using the code below. Note the band of missing data between about 140°E (the central meridian of the projection?) and the 180°E (the right hand side of the image). https://anero.id/geotools-202003/geotools-web-mercator.png public void test(File in /* himawari-8-visible-eqc.tif */, File out /* geotools-web-mercator.png */) { AbstractGridFormat format = GridFormatFinder.findFormat(in); AbstractGridCoverage2DReader reader = format.getReader(in); Layer rasterLayer = new GridReaderLayer(reader, SLD.wrapSymbolizers(CommonFactoryFinder.getStyleFactory().getDefaultRasterSymbolizer())); MapContent mapContent = new MapContent(); mapContent.addLayer(rasterLayer); StreamingRenderer renderer = new StreamingRenderer(); //Map<Object, Object> rendererParams = new HashMap<>(); //rendererParams.put(StreamingRenderer.CONTINUOUS_MAP_WRAPPING, Boolean.TRUE); //renderer.setRendererHints(rendererParams); // had no effect renderer.setMapContent(mapContent); BufferedImage image = new BufferedImage(2048, 2048, BufferedImage.TYPE_INT_RGB); try { renderer.paint(image.createGraphics(), new Rectangle(image.getWidth(), image.getHeight()), new ReferencedEnvelope( -20026376.39, 20026376.39, -20026376.39, 20026376.39, CRS.decode("EPSG:3857"))); ImageIO.write(image, "png", out); } catch (Exception e) { e.printStackTrace(); } } Many thanks in advance for any help. Regards, Andrew
_______________________________________________ GeoTools-GT2-Users mailing list GeoTools-GT2-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users