From: Michael B. <mic...@gm...> - 2010-12-22 01:49:27
|
There was some discussion of a WritableGridCoverage2D class a while ago between Simone, myself and other list members. It got as far as a (very) basic example in the demo module (org.geotools.demo.coverage.WritableGridDemo). That would be the place for setxXXX( world-coords ) methods with interpolation options. Since your source data are already on a regular grid perhaps interpolation isn't required (?). If that's the case, you can simplify the world to grid (image) coords calculations somewhat... GridEnvelope2D gridEnv = new GridEnvelope2D(0, 0, gridWidth, gridHeight); ReferencedEnvelope worldEnv = new ReferencedEnvelope(minWorldX, maxWorldX, minWorldY, maxWorldY, crs); GridGeometry2D gg = new GridGeometry2D(gridEnv, worldEnv); Now you can convert from world coordinates to grid coordinates: DirectPosition2D pos = new DirectPosition2D(x, y); GridCoordinates2D gridCoords = gg.worldToGrid(pos); Or if your source coords are in a different projection... pos = new DirectPosition2D(srcCRS, x, y); GridCoordinates2D gridCoords = gg.worldToGrid(pos); Does that help at all ? Michael On 22 December 2010 05:22, Ian Turton <ijt...@gm...> wrote: > On Tue, Dec 21, 2010 at 12:56 PM, Andrea Aime > <and...@ge...> wrote: >> On Tue, Dec 21, 2010 at 4:29 PM, Ian Turton <ijt...@gm...> wrote: >>> >>> >>> That's the sort of thing I was trying, is there a way to do this with >>> world x,y coords instead of image coords? >> >> I think that is normally called interpolation :-) >> Look for Inverse Distance Weighted, tensioned splines, or Kriging >> (I don't think we have an implementation of any, IDW is trivial to >> implement though, at least a low performance version of it): >> http://en.wikipedia.org/wiki/Inverse_distance_weighting > > I'm doing my own kernel estimation to convert my circles to a raster > representation but I've been working in world coords (as that seemed > easier) and was looking for a setDataValue(double x, double y, double > value) method that would save me from having to worry about which way > the Y axis ran and where the edges where for the raster etc. But it > seems not to be there? > > Ian > |