Hello!
I finally got around to fiddling with this. I have adapted the GeoTiff metadata reader to map the data projection to Lambert Cylindrical Equal area (see https://github.com/havochvatten/geotools/commit/af1249a5e92d36c9458968b5107a07f024800614). [https://opengraph.githubassets.com/ebf9d246cfef08aac44da746aa74d0ae728b0e28946a43a5012cb63979a93b79/havochvatten/geotools/commit/af1249a5e92d36c9458968b5107a07f024800614]<https://github.com/havochvatten/geotools/commit/af1249a5e92d36c9458968b5107a07f024800614> Add support for Lambert Cylindrical Equal Area projection · havochvatten/geotools@af1249a · GitHub<https://github.com/havochvatten/geotools/commit/af1249a5e92d36c9458968b5107a07f024800614> github.com Official GeoTools repository. Contribute to havochvatten/geotools development by creating an account on GitHub. In this screenshot (https://doc-04-7c-docs.googleusercontent.com/docs/securesc/smf9j6sn1qj99kfjl4ddbaa5t9dq0gp2/q90m7v01kssfh9dinqn6ch7j6kqmkipf/1662380625000/01609012044445035763/01609012044445035763/16mkgN4Xf6xrzNlIkPEgMW67Aab1QvFUS?e=download) the resulting coverage is reprojected to EPSG:3857 and laid on top of an OSM background map. Unfortunately it appears a bit off as the empty areas off the coast of South Africa and Madagascar indicates. QGIS does get it right. QGIS and gdalinfo reports the following projection WKT: PROJCRS["WGS_1984_Cylindrical_Equal_Area", BASEGEOGCRS["WGS 84", DATUM["World Geodetic System 1984", ELLIPSOID["WGS 84",6378137,298.257223563, LENGTHUNIT["metre",1]]], PRIMEM["Greenwich",0, ANGLEUNIT["degree",0.0174532925199433]], ID["EPSG",4326]], CONVERSION["Lambert Cylindrical Equal Area", METHOD["Lambert Cylindrical Equal Area", ID["EPSG",9835]], PARAMETER["Latitude of 1st standard parallel",-12, ANGLEUNIT["degree",0.0174532925199433], ID["EPSG",8823]], PARAMETER["Longitude of natural origin",12, ANGLEUNIT["degree",0.0174532925199433], ID["EPSG",8802]], PARAMETER["False easting",0, LENGTHUNIT["metre",1], ID["EPSG",8806]], PARAMETER["False northing",0, LENGTHUNIT["metre",1], ID["EPSG",8807]]], CS[Cartesian,2], AXIS["easting",east, ORDER[1], LENGTHUNIT["metre",1, ID["EPSG",9001]]], AXIS["northing",north, ORDER[2], LENGTHUNIT["metre",1, ID["EPSG",9001]]]] Geotools (26.5) calling toWKT() on the coverage reports: GEOGCS["WGS 84", DATUM["World Geodetic System 1984", SPHEROID["WGS 84", 6378137.0, 298.257223563, AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], UNIT["degree", 0.017453292519943295], AXIS["Geodetic longitude", EAST], AXIS["Geodetic latitude", NORTH], AUTHORITY["EPSG","4326"]], PROJECTION["Cylindrical_Equal_Area"], PARAMETER["central_meridian", 12.0], PARAMETER["standard_parallel_1", -12.0], PARAMETER["false_easting", 0.0], PARAMETER["false_northing", 0.0], UNIT["m", 1.0], AXIS["Easting", EAST], AXIS["Northing", NORTH]] The above is with my applied patch, but results are the same (the WKT and the resulting slightly off raster extents) when converting the file to NetCDF using gdal and reading that using an unpatched Geotools 26.5. The main difference I can see is that gdalinfo and QGIS reports an ELLIPSOID base CRS, whereas Geotools toWKT says SPHEROID. How can I tell GeoTools to use an ellipsoid base CRS? Any other tips? Warm regards, Tobias Gerdin Från: Andrea Aime <andrea.a...@geosolutionsgroup.com> Skickat: den 11 februari 2022 15:56 Till: Tobias Gerdin <tobias.ger...@havochvatten.se> Kopia: geotools-gt2-users@lists.sourceforge.net Ämne: Re: [Geotools-gt2-users] Loading GeoTIFF in ESRI:54034 CRS Yes, it's unique to GeoTIFFs... however trying to store rasters in GeoPackage will mean that you are using a less used raster store, and one that can only handle RBG images, at the moment at least. PostGIS raster is also unsupported and has not seen any new development in a while, not sure if it works. Best to go and improve the GeoTIFF reader so that it can support your projection too, IMHO Cheers Andrea On Fri, Feb 11, 2022 at 1:59 PM Tobias Gerdin <tobias.ger...@havochvatten.se<mailto:tobias.ger...@havochvatten.se>> wrote: Hello again, Is this issue particular to GeoTiffs? I.e. would it perhaps work out of the box if I read the raster from a GeoPackage, or from PostGIS? The only reason we store this raster data in GeoTiffs at the moment is because it was deemed easiest. But CRS-handling in GeoTiffs seems somewhat complicated so if there is a way to work around this issue it may be worthwhile (although getting this to work with GeoTiffs would be best for GeoTools ofcourse!) Regards, Tobias Från: Andrea Aime <andrea.a...@geosolutionsgroup.com<mailto:andrea.a...@geosolutionsgroup.com>> Skickat: den 9 februari 2022 14:25 Till: Tobias Gerdin <tobias.ger...@havochvatten.se<mailto:tobias.ger...@havochvatten.se>> Kopia: geotools-gt2-users@lists.sourceforge.net<mailto:geotools-gt2-users@lists.sourceforge.net> Ämne: Re: [Geotools-gt2-users] Loading GeoTIFF in ESRI:54034 CRS Hi Tobias, yes it should be possible. Some code for a CyclidricalEqualArea projection was donated to the project in 2017: https://github.com/geotools/geotools/blob/50b283a7c9229d6c64160b3e8a17eede1c7fa2f4/modules/library/referencing/src/main/java/org/geotools/referencing/operation/projection/CylindricalEqualArea.java#L30<https://url10.mailanyone.net/v1/?m=1nHmxn-0005eA-4v&i=57e1b682&c=wdQnpCL5wmQcX_G_Js5fL3zVNPDc_K5F5-9jsALHOwTPQL7sJesac03PAPP9y962bKdeAiplEGEoeS3dqaUjZOWttxGbMxNROh5z6bUPT2HiywIPNTLIT-JYCdnIcxfjo3u0h9eFP7wx4RBStf2bPtFPhLG0XDU48LM0BRB3Jl02fgg5Qp2ofSEkjtUdbzp47KR72n1pxE_sbKBm9F86MmH7-2v-Ymv14AIdyG0aG0KGo8E_BEMRGe-_ys2hXLXugVQBCc9sfDnYooilpHwcE94_r0b6Gqa-_djxmRevjQIxmhlaFhYK0lss5qwzKBuA72VD9DKkLIenfSsgM0AdgMYJgBRVt0TZxGK2jrpGfTstd-VQ1U4YPE8QTC2RI-ZVsx_O8XUrByiHFGUfSbyDOCKCsV4rQ2DQZcuIz0ia2RvB4_GyVyVHaFLCKb6hgKoygf-_GLaQS1A2BYx2yUztKg> Assuming it's the right match, I'm guessing the GeoTiffMetadata2CRSAdapter class could be adapted to make use of it: https://github.com/geotools/geotools/blob/5b917631ffbc21f9348e3baead175d3772c0ea7e/modules/library/coverage/src/main/java/org/geotools/coverage/grid/io/imageio/geotiff/GeoTiffMetadata2CRSAdapter.java#L965<https://url10.mailanyone.net/v1/?m=1nHmxn-0005eA-4v&i=57e1b682&c=jjemjc3LLewOVrVfg_mT6n9rsIjGm_7mvS2hQ1JfptKeWOTVca1gMPGp7b8Ox-lhRlzFeLF6csuEmT7QIyA6X91JdHRp9-M43qVGs-ew_CCXvrrJGKK3ES6BKwEfaVOvY_2jPmNqtYLySBXKOpAVrglEM0dx3YeN9FBgTau4-RtZML68gIU5DYSstzqoMc6Mu_il9WYLS0gceR_Frqv8Ez8J9UUSs6_sMxAVcbQG8aemZjTNDMCp6mkhyTRYqpHckRta_JWeSvi7OqulClMbzx0a7al8LPGyuS7dncmlQXuoPqEWaWGf23PuhTE2oDvH5WbAgf67NtNeVIsN_hN9--MK4T0tPctkNu_HKHDj7a8lortnRzp1k6c6IseceyQ7eOntp46jn5IbCxvz0CwqLXlKaYYUSUTY8vbkos16XL5CVBAvO57mR2tJj5UbCQ1gS9P-17KeaVr49SDhCvtG0g> Cheers Andrea Havs- och vattenmyndigheten behandlar dina personuppgifter i enlighet med dataskyddsförordningen och myndighetens dataskyddspolicy, läs mer på www.havochvatten.se/sa-behandlar-hav-dina-personuppgifter<https://www.havochvatten.se/sa-behandlar-hav-dina-personuppgifter> SwAM processes your personal data in accordance with the General Data Protection Regulation (GDPR) and our Data Protection Policy, see www.havochvatten.se/sa-behandlar-hav-dina-personuppgifter<https://www.havochvatten.se/sa-behandlar-hav-dina-personuppgifter>
_______________________________________________ GeoTools-GT2-Users mailing list GeoTools-GT2-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users