Source:
<code>public static Map<String, Grid> fromShapefile (File shapefile, int zoom, BiConsumer<Integer, Integer> statusListener) throws IOException, FactoryException, TransformException { Map<String, Grid> grids = new HashMap<>(); ShapefileReader reader = new ShapefileReader(shapefile); Envelope envelope = reader.wgs84Bounds(); int total = reader.getFeatureCount(); if (statusListener != null) statusListener.accept(0, total); AtomicInteger count = new AtomicInteger(0); reader.wgs84Stream().forEach(feat -> { Geometry geom = (Geometry) feat.getDefaultGeometry(); for (Property p : feat.getProperties()) { Object val = p.getValue(); if (val == null || !Number.class.isInstance(val)) continue; double numericVal = ((Number) val).doubleValue(); if (numericVal == 0) continue; String attributeName = p.getName().getLocalPart(); if (!grids.containsKey(attributeName)) { grids.put(attributeName, new Grid( zoom, envelope.getMaxY(), envelope.getMaxX(), envelope.getMinY(), envelope.getMinX() )); } Grid grid = grids.get(attributeName); if (geom instanceof Point) { Point point = (Point) geom; grid.incrementPoint(point.getY(), point.getX(), numericVal); } else if (geom instanceof Polygon || geom instanceof MultiPolygon) { grid.rasterize(geom, numericVal); } else { throw new IllegalArgumentException("Unsupported geometry type"); } } int currentCount = count.incrementAndGet(); if (statusListener != null) statusListener.accept(currentCount, total); <START> if (currentCount % 100 == 0) { <END> LOG.info("{} / features read", human(currentCount), human(total)); } }); reader.close(); return grids; }</code><technical_language>This is produce large amounts of log output large Shapefiles. Do need more a log entries indicating file is processed</technical_language>

Target:
public static Map<String, Grid> fromShapefile (File shapefile, int zoom, BiConsumer<Integer, Integer> statusListener) throws IOException, FactoryException, TransformException { Map<String, Grid> grids = new HashMap<>(); ShapefileReader reader = new ShapefileReader(shapefile); Envelope envelope = reader.wgs84Bounds(); int total = reader.getFeatureCount(); if (statusListener != null) statusListener.accept(0, total); AtomicInteger count = new AtomicInteger(0); reader.wgs84Stream().forEach(feat -> { Geometry geom = (Geometry) feat.getDefaultGeometry(); for (Property p : feat.getProperties()) { Object val = p.getValue(); if (val == null || !Number.class.isInstance(val)) continue; double numericVal = ((Number) val).doubleValue(); if (numericVal == 0) continue; String attributeName = p.getName().getLocalPart(); if (!grids.containsKey(attributeName)) { grids.put(attributeName, new Grid( zoom, envelope.getMaxY(), envelope.getMaxX(), envelope.getMinY(), envelope.getMinX() )); } Grid grid = grids.get(attributeName); if (geom instanceof Point) { Point point = (Point) geom; grid.incrementPoint(point.getY(), point.getX(), numericVal); } else if (geom instanceof Polygon || geom instanceof MultiPolygon) { grid.rasterize(geom, numericVal); } else { throw new IllegalArgumentException("Unsupported geometry type"); } } int currentCount = count.incrementAndGet(); if (statusListener != null) statusListener.accept(currentCount, total); if (currentCount % 10000 == 0) { LOG.info("{} / features read", human(currentCount), human(total)); } }); reader.close(); return grids; }