2

I'm trying to convert a CQL filter to OCG. I followed this example: https://blog.ianturton.com/geotools/code/ogc/2015/03/18/Generating-OGC-Filters.html

In line with org.geotools.xml.Configuration configuration = new org.geotools.filter.v1_0.OGCConfiguration(); I get

"Incompatible types error: Required: org.geotools.xml.Configuration Found: org.geotools.filter.v1_0.OGCConfiguration"

What could be the problem, since I'd say that the example provided in the link is working.

My dependency for that part is:

<dependency>
  <groupId>org.geotools.xsd</groupId>
  <artifactId>gt-xsd-filter</artifactId>
  <version>21.0</version>
</dependency>
2

As a fuller answer if you want to use this code in GeoTools v21+ you need to change the imports to be:

import org.geotools.xsd.Configuration;
import org.geotools.xsd.Encoder;

and the dependancies to:

<dependencies>
    <dependency>
        <groupId>org.geotools</groupId>
        <artifactId>gt-main</artifactId>
        <version>${geotools.version}</version>
    </dependency>
    <dependency>
        <groupId>org.geotools.xsd</groupId>
        <artifactId>gt-xsd-filter</artifactId>
        <version>${geotools.version}</version>
    </dependency>
    <dependency> <!--for fes (filter 2.0)-->
        <groupId>org.geotools.xsd</groupId>
        <artifactId>gt-xsd-fes</artifactId>
        <version>${geotools.version}</version>
    </dependency>
    <dependency>
        <groupId>org.geotools</groupId>
        <artifactId>gt-cql</artifactId>
        <version>${geotools.version}</version>
    </dependency>
</dependencies>
2

As @IanTurton mentioned in comments, my problem was that I was using version 21.0. Going back to v20 solved my issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.