String unit = bounds.getCoordinateReferenceSystem().getCoordinateSystem().getAxis(0).getUnit().toString();
final AxisDirection direction = bounds.getCoordinateReferenceSystem().getCoordinateSystem().getAxis(0).getDirection();
int numDimensions = bounds.getCoordinateReferenceSystem().getCoordinateSystem().getDimension();
DefaultFeatureCollection features = new DefaultFeatureCollection();
double pointSpacing = bounds.getSpan(1) / layerData.pointsInLine;
int i = 0;
for (double x = minX; x < bounds.getMaxX(); x += xSpace) {
i++;
final SimpleFeature feature = createFeature(mapContext, featureBuilder, geometryFactory, layerData,
unit, direction, numDimensions, pointSpacing, x, bounds.getMinimum(1), i, 1);
features.add(feature);
}
pointSpacing = bounds.getSpan(0) / layerData.pointsInLine;
int j = 0;
for (double y = minY; y < bounds.getMaxY(); y += ySpace) {
j++;
final SimpleFeature feature = createFeature(mapContext, featureBuilder, geometryFactory, layerData,
unit, direction, numDimensions, pointSpacing, bounds.getMinimum(0), y, j, 0);
features.add(feature);
}
return features;
}