// build the layer query and execute it
if (layer == null) {
String sql = getLayerSql(querySchema == sourceSchema ? null : querySchema,
filterTx.getAttributeFilter(), query.getSortBy());
Pointer spatialFilterPtr = null;
Geometry spatialFilter = filterTx.getSpatialFilter();
if (spatialFilter != null) {
spatialFilterPtr = new GeometryMapper.WKB(new GeometryFactory())
.parseGTGeometry(spatialFilter);