Search code examples
springspring-bootcassandracqlgeomesa

Executing a query on geomesa cassandra datastore using JAVA


i have been following the geomesa cassandra quickstart tutrorila https://www.geomesa.org/documentation/tutorials/geomesa-quickstart-cassandra.html and now i am build a spring boot api to query on the imported table, in the example code i find CQL filter which acts as the WHERE part in the normal sql query:

new Query(getTypeName(), ECQL.toFilter( "Actor2CountryCode LIKE 'AU'" ))

but i cant figure out how to write the SELECT FROM part using this ECQL query


Solution

  • It is not generally feasible to query GeoMesa raw data directly - you should instead use the GeoTools API and GeoTools ECQL filters (not Cassandra CQL).

    To see what select statements are generated from a given GeoTools query, you can use the getQueryPlan method as described in the GeoMesa documentation. This will return an instance of CassandraQueryPlan which has a reference to the statements to execute (see here). Note that there may be a secondary filter applied on the results of the statements, defined as clientSideFilter in the query plan.