final ReferencedEnvelope bounds = features.getBounds();
final CoordinateReferenceSystem crs = bounds != null ? bounds.getCoordinateReferenceSystem() : null;
if (bounds != null) {
if (encodeFeatureCollectionBounds) {
obj.put("bbox", new JSONStreamAware() {
public void writeJSONString(Writer out) throws IOException {
JSONArray.writeJSONString(Arrays.asList(bounds.getMinX(),
bounds.getMinY(), bounds.getMaxX(), bounds.getMaxY()), out);
}
});