Hello,

I painted a small Graphic that should help to understand my current problem
(I didn't want to post it on the mailing list directly)

Here is the Link to the graphic.
http://bayimg.com/oaNDJAaBn


I created a GridCoverage with a specified cellsize to rasterize an area

double width = envelope.getWidth(); // i.e. 1000m
double height = envelope.getHeight(); // i.e. 1000m

int numCellX = (int) Math.floor( width / cellSize ); // cellSize i.e. 10m
int numCellY = (int) Math.floor( height / cellSize );

WritableRaster raster = RasterFactory.createBandedRaster(
                DataBuffer.TYPE_FLOAT,
                numCellX, numCellY, 1, null );

GridCoverage2D gridCoverage = factory.create( "My coverage",
                raster,
                envelope );


Now my Problem:

The values of a cell in the raster depends on the length of the LineString
covering the cell.
(in my Image the green part of the LineString would determine the value of
d;2)

I belive that their is no function available doing that.
So my idea to solve my problem is some workaround I'm not really satisfied
with.

1.create a graph corresponding to the raster (width, height and cellsize)
2.for a given LineString find all intersection points with the created graph
3.for all following intersection points (i, i+1)
       a.calculate the length -> value for the cell
       b.get the middle point between (i, i+1) to find the corresponding
cell
       c.add value to cell

Maybe somebody has a smarter idea to solve my problem.

Thanks
------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to