int defMaxDecimals = writer.getMaximunFractionDigits();
FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
for (int i = 0; i < nLayers; i++) {
Layer layer = layers.get(i);
SimpleFeatureIterator featureReader = null;
SimpleFeatureSource fSource;
fSource = (SimpleFeatureSource) layer.getFeatureSource();
SimpleFeatureType schema = fSource.getSchema();
try {
String defaultGeometry = schema.getGeometryDescriptor().getName().getLocalPart();
ReferencedEnvelope renderingArea = mapContent.getRenderingArea();
BBOX bboxFilter = ff.bbox(ff.property(defaultGeometry), renderingArea);
Query bboxQuery = new Query(schema.getTypeName(), bboxFilter);
Query definitionQuery = layer.getQuery();
Query finalQuery = new Query(DataUtilities.mixQueries(definitionQuery, bboxQuery,
"svgEncoder"));
finalQuery.setHints(definitionQuery.getHints());
finalQuery.setSortBy(definitionQuery.getSortBy());
finalQuery.setStartIndex(definitionQuery.getStartIndex());
LOGGER.fine("obtaining FeatureReader for " + schema.getTypeName());
featureReader = fSource.getFeatures(finalQuery).features();
LOGGER.fine("got FeatureReader, now writing");
String groupId = null;
String styleName = null;
groupId = schema.getTypeName();
styleName = layer.getStyle().getName();
writer.write("<g id=\"" + groupId + "\"");
if (!styleName.startsWith("#")) {
writer.write(" class=\"" + styleName + "\"");