From: Jan V. <jvo...@gm...> - 2009-12-07 02:45:23
|
Hi Michael and Andrea, Thanks for the hint, that makes more sense. But it didn't solve the problem - still array out of bounds. I tried a few things and found that it works when i change the sample model to 10 x 10 size (data matrix is 100 x 100): SampleModel model = new BandedSampleModel(DataBuffer.TYPE_INT, 10, 10, 1); Now if i change the sample model to 11 x 11 for example (or more, 20x20 or 100x100), i get an out of bounds exception. ... Actually, it seems that my problem is not only about this technical detail - i think i need more general advise: Basically, my input is a simple 2D map with simple lines on it. A line represents a "wall". Everything else is "ground". So there are only 2 categories of data, which should be colored in 2 colors. The 2D map can be internally represented in any way - eg. 2D array of int, 2D buffered image with colors, etc. The output should be a GeoTiff file with a rendered image and geo tags. So far, I have tried the approach described earlier (2D array of int). Do you think it is the right way of doing it? I have also tried building an RGB buffered image and encoding the "wall/ground" distinction in the value of "red" (e.g. 0 = ground, 255 = wall). That grid coverage was created successfully, but I could not manage to get a "geophysics" view of the grid coverage. It would get a NullPointerException and this problem would occur every time when writing a GeoTiff. Other types of view ("rendered", ...) would work fine. I would really appreciate any hits as to which direction should i take? I did read a lot of the articles and docs on GeoTools, but still feel rather uncertain. Thanks a lot for your help. Best, Jan |