Martin Desruisseaux-2 wrote: > > Olaf Danne a écrit : >> we still have problems when reprojecting raster data, which we basically >> already described in >> >> http://www.nabble.com/Raster-file-reprojection-problems-tf3180801.html#a8826611 > > Maybe Simone could tell more. For now, I don't know if the problem happen > with > Geotools GridCoverage renderer or Geotools GridCoverage resample > operation. > Would it be possible to try to reproject a GridCoverage using the > following code > and check if the result is the expected one please? > > GridCoverage2D coverage = ...; > System.out.println(coverage.getEnvelope()); > > CoordinateReferenceSystem targetCRS = ...; > coverage = Operations.DEFAULT.resample(coverage, targetCRS); > System.out.println(coverage.getEnvelope()); > > ImageIO.write(coverage.getRenderedImage(), "png", outputFile); > > Martin > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Geotools-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/geotools-devel > >
Martin, thanks for your reply. - Simply applying the piece of code you suggested leads to the strange image 'coverage.png' attached below. It looks the same if we use a PolarStereographic or an AzimithalEquidistant projection to define a target CRS). I guess this is not really what you expected to see here? However, I tried to understand a bit more what happens in the GridCoverageRenderer. I took all the code in an own class and produced all the 'in-between' images in debug mode using a PolarStereographic transformation with latitudeOfOrigin=90N, longitudeOfOrigin=0 and a view angle of 60deg. The resulting sequence original.gif cropped.gif preScaled.gif scaled.gif reprojected.gif preSymbolizer.gif final0.gif ourresult.gif is attached below. As you can see, already the 'cropped.gif' is screwed up. At least the missing part on the west side should not have been cropped. Looking into GridCoverageRenderer, it can be seen that the cropping is determined by 'destinationEnvelopeInSourceGCCRS' which is calculated in CRSUtilities.transform. The GeneralEnvelope returned from this method is [116°33.8'W 41°59.9'S , 180°00.0'E 89°59.5'N] for this case. This is consistent with the 'cropped.gif' and also the final result. When we set this envelope closely to 180 deg. on both west and east side ([170°0'W 41°59.9'S , 170°0'E 89°59.5'N], we obtain the result shown in 'ourresult_170.png'. If I understand correctly the way this envelope is applied, this suggests to me that we will always loose parts of the coverage in a circumpolar representation like this, dependent on the longitude values. Either parts on the left/right of the image, or triangles close to +-180deg. are gone. Am I wrong? What do you think? Olaf coverage.png: http://www.nabble.com/file/7535/coverage.png original: http://www.nabble.com/file/7528/original.gif cropped: http://www.nabble.com/file/7529/cropped.gif prescaled: http://www.nabble.com/file/7530/prescaled.gif scaled: http://www.nabble.com/file/7531/scaled.gif reprojected: http://www.nabble.com/file/7532/reprojected.gif preSymbolizer: http://www.nabble.com/file/7532/preSymbolizer.gif final0: http://www.nabble.com/file/7532/final0.gif ourresult: http://www.nabble.com/file/7533/ourresult.PNG ourresult_170: http://www.nabble.com/file/7534/ourresult_170.PNG -- View this message in context: http://www.nabble.com/Still-problems-with-reprojecting-raster-data-tf3472146.html#a9735764 Sent from the geotools-devel mailing list archive at Nabble.com. ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Geotools-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
