I'm having trouble to load a GeoTIFF file using Geotools (never used it before). What I've tried so far:
File koppenClassificationTif = new File("mongodb-repository/src/main/resources/land_shallow_topo_2048.tif");
GeoTiffFormat format = new GeoTiffFormat();
Hints hints = new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE);
GeoTiffReader reader = format.getReader(koppenClassificationTif, hints);
The GeoTiffFormat could not be initialized because of java.lang.NoSuchMethodError: 'javax.measure.Unit javax.measure.Unit.multiply(java.lang.Number)'
. My .m2 repository contain 2 versions javax/measure/unit-api but I don't see why this would be a problem.
I've also tried to directly use GeoTiffReader reader = new GeoTiffReader(koppenClassificationTif);
which throw this exception:
org.geotools.data.DataSourceException: class org.apache.sis.referencing.factory.GeodeticObjectFactory cannot be cast to class org.opengis.referencing.Factory (org.apache.sis.referencing.factory.GeodeticObjectFactory and org.opengis.referencing.Factory are in unnamed module of loader 'app')
I'm using newly released 25.0 but I've been experiencing the same issue using 24.2
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-geojsondatastore</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-referencing</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-coverage</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-opengis</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-geotiff</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-main</artifactId>
<version>${geotools.version}</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>osgeo-alt</id>
<url>https://repo.osgeo.org/repository/release</url>
</repository>
</repositories>
<properties>
<geotools.version>25.0</geotools.version>
</properties>
pom.xml
file to your question please