简体   繁体   中英

Java impossible to import class GridCoverage from Geotools

I'm trying to import some class from Geotools but its seems objects are not recognize:

public Coverage() {
        File file = new File("test.tiff");

        AbstractGridFormat format = GridFormatFinder.findFormat(file);
        GridCoverage2DReader reader = format.getReader(file);

        GridCoverage2D coverage = reader.read(null);

    }

I already import this lib:

geotools_version = '25'
implementation "org.geotools:gt-coverage:${geotools_version}"

Source: https://docs.geotools.org/latest/userguide/library/coverage/grid.html

In case of build.gradle , use the following.

In case of higher version of gradle like 6, use below.

implementation 'org.geotools:gt-coverage:24.2'

In case of lower version of gradle like 4, use the below.

compile group: 'org.geotools', name: 'gt-coverage', version: '24.2'

After making changes, use your favorite ide, refresh the gradle project. Once it is done, you will be able to import the class.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM