@Override
protected ReferencedEnvelope getBoundsInternal(Query query) throws IOException {
// there appears to be no way to obtain the bbox from couch documents
// (aka features) without getting all the geometry as well.
// one approach might be to write a view that only returns bbox?
CouchDBSpatialView spatialView = getDataStore().getConnection().spatialView(viewName);
Envelope e = getBBox(query);
JSONObject results;
try {
results = spatialView.get(e.getMinX(),e.getMinY(),e.getMaxX(),e.getMaxY());
} catch (CouchDBException ex) {
throw ex.wrap();
}
Envelope env = null;
JSONArray rows = (JSONArray) results.get("rows");