From: Ian T. <ijt...@gm...> - 2010-12-21 04:07:30
|
Does any one have example code of how I could go about building a GridCoverage2D from an array of doubles? Currently I have: private GridCoverage2D convert(ArrayList<Circle> results) { ReferencedEnvelope resBounds = new ReferencedEnvelope(bounds.getCoordinateReferenceSystem()); for(Circle c:results) { resBounds.expandToInclude(c.getBounds()); } System.out.println(resBounds); GridCoverageBuilder builder = new GridCoverageBuilder(); builder.setEnvelope(bounds); builder.setCoordinateReferenceSystem(bounds.getCoordinateReferenceSystem()); final double scale = 1000.0; final int width = (int)(resBounds.getWidth()/scale); final int height = (int)(resBounds.getHeight()/scale); builder.setImageSize(width, height); BufferedImage img = builder.getBufferedImage(); QuantizeCircle qc = new QuantizeCircle(img); qc.setCellsize(scale); for(Circle c:results) { qc.quantize(c); } return builder.getGridCoverage2D(); } But I'm struggling with the quantize function as the image doesn't seem to be the size I was expecting, so I thought I'd ask here to see if there is an easier way to do this? Thanks Ian PS If you want to see all the code look at http://code.google.com/p/spatial-cluster-detection/source/browse/trunk/cluster/?r=10 -- Ian Turton |