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
------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users