Of course, the OGR datastore passes bbox filters directly in the data access API, not as part of the SQL, so there is no need to translate them. If the OGR SQL has a way to express spatial filters, feel free to extend the OGRFilterTranslator as you see fit.
Cheers Andrea On Tue, Oct 13, 2020 at 10:06 AM maven apache <apachemav...@gmail.com> wrote: > public class FilterTest { > static { > ogr.RegisterAll(); > } > > public static void main(String[] args) throws CQLException, IOException { > Map<String, Object> params = new HashMap<>(); > params.put("DriverName", "xxx"); > params.put("DatasourceName", xxx); > > DataStore dataStore = DataStoreFinder.getDataStore(params); > SimpleFeatureSource sfs = dataStore.getFeatureSource("water"); > Filter filter = CQL.toFilter("BBOX(" + > sfs.getSchema().getGeometryDescriptor().getLocalName() + ", 20,30,21,31) and > num <= 10"); > OGRFilterTranslator ogrFilterTranslator = new > OGRFilterTranslator(sfs.getSchema(), filter); > System.out.println(ogrFilterTranslator.getSpatialFilter()); > System.out.println(ogrFilterTranslator.getPostFilter()); > System.out.println(ogrFilterTranslator.getAttributeFilter()); > } > } > > Output: > > null > [ the_geom bbox ReferencedEnvelope[20:21,30:31] ] > num <= 10 > > Seems like that the bbox filter is not recognized by OGRFilterTranslator > _______________________________________________ > GeoTools-GT2-Users mailing list > GeoTools-GT2-Users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > -- Regards, Andrea Aime == GeoServer Professional Services from the experts! Visit http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- *Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia. This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.*
_______________________________________________ GeoTools-GT2-Users mailing list GeoTools-GT2-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users