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 <[email protected]> wrote:
> On Tue, Dec 21, 2010 at 12:56 PM, Andrea Aime
> <[email protected]> wrote:
>> On Tue, Dec 21, 2010 at 4:29 PM, Ian Turton <[email protected]> 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
>

------------------------------------------------------------------------------
Forrester recently released a report on the Return on Investment (ROI) of
Google Apps. They found a 300% ROI, 38%-56% cost savings, and break-even
within 7 months.  Over 3 million businesses have gone Google with Google Apps:
an online email calendar, and document program that's accessible from your 
browser. Read the Forrester report: http://p.sf.net/sfu/googleapps-sfnew
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to