Hi all,
I'm trying to render a map context into a BufferedImage using StreamingRenderer. Problem is all the images that i get out of it are completely black. I've been trying to get this to work for a while now and can't seem to find the problem. Any help would be much appreciated.
Here's my rendering code:

    protected BufferedImage renderImage(MapContext map, int width, int height) {
        BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
        Graphics2D graphic = image.createGraphics();
        Rectangle paintArea = new Rectangle(width, height);
        Envelope mapArea = map.getAreaOfInterest();

        StreamingRenderer renderer = new StreamingRenderer();
        renderer.setContext(map);

        RenderingHints hints = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        renderer.setJava2DHints(hints);

        Map<String, Object> rendererParams = new HashMap<String, Object>();
        rendererParams.put("optimizedDataLoadingEnabled", true);
        renderer.setRendererHints(rendererParams);

        renderer.paint(graphic, paintArea, mapArea);

        return image;
    }

thanks,
joel
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to