3

Is there a java library for converting ECQL(geotools) to SQL ?

CQL and ECQL CQL (Common Query Language) is a query language created by the OGC for the Catalogue Web Services specification.

Fiz
  • 59
  • 4

1 Answers1

5

GeoTools can convert most (many?) filter objects to SQL before sending them to a JDBCDatastore but it usually depends on which database you are targetting. See, for example, org.geotools.data.postgis.PostgisFilterToSQL - you could do something like:

Filter filter = EQCL.toFilter("My filter goes here");
FilterToSQL encoder = new PostgisFilterToSQL(new PostGISDialect(null));
encoder.setInline(true); // don't adding WHERE
String sql = encoder.encodeToString(filter);
Ian Turton
  • 10,018
  • 1
  • 28
  • 47