I am new in using GeoTools (8.2). I was able to create shp from asc file which contains my data.
Is there a simple way to create (interpolate) a simple shapefile (only points) to raster image?
I am new in using GeoTools (8.2). I was able to create shp from asc file which contains my data.
Is there a simple way to create (interpolate) a simple shapefile (only points) to raster image?
You can use the Barnes Surface process using code like this:
public GridCoverage2D interpolate(SimpleFeatureCollection features, String value) {
Name pName = new NameImpl("vec", "BarnesSurface");
org.geotools.process.Process process = Processors.createProcess(pName);
ProcessExecutor engine = Processors.newProcessExecutor(2);
ReferencedEnvelope bounds = features.getBounds();
double aspectRatio = bounds.getHeight() / bounds.getWidth();
int width = 1000;
int height = (int) (aspectRatio * width);
Map<String, Object> input = new KVP("data", features, "valueAttr", value, "scale", 1000, "queryBuffer", 1000,
"outputBBOX", bounds, "outputWidth", width, "outputHeight", height);
Progress working = engine.submit(process, input);
Map<String, Object> result = null;
try {
result = working.get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
} // get is BLOCKING
return (GridCoverage2D) result.get("result");
}