[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
| [udig-devel] Re: [-DETECTION SPAM-] [Geotools-devel] Re: Raster	Data Images | 
simone giannecchini a écrit :
The problem I ran into is that when I create a grid
coverage from a REAL buffered image (which means not just a container
for FLOAT, DOUBLE or other geophisic data) the GridCoverage2D class
automatically tries to create a non geophysisc view of it.
You should be able to control a non-geophysics view...
Reminder (for peoples not familiar to this geophysics stuff in 
GridCoverage):
  - "geophysics" image contains "real world" values (e.g. sea surface
    temperature in °C) to be used for computation. Pixel values in
    "geophysics" are usually (but not required) floating-point numbers.
  - "non-geophysics" image pack the values into integers. Those integers
    are related to the "real world" values (i.e. "geophysics") through
    OpenGIS's 'scale', 'offset' and 'nodata' attributes (defined in OGC
    specification). The "non-geophysics" image is usually much more
    efficient for rendering.
If you are creating an image from "real world" data (e.g. temperature in 
°C), then you can create the "geophysics" image and let Geotools creates 
the "non-geophysics" image on the fly.
If you are creating an image from "packed" data (usually integer 
values), then you can create the "non-geophysics" image and let Geotools 
creates the "geophysics" image on the fly.
In other words, "geophysics" and "non-geophysics" images are always 
together; they are two representations of the same data (the first one 
more appropriate for computation, the second one more appropriate for 
display). You create one of them, and Geotools create the other one on 
the fly only if needed. "One of them" do not means "the geophysics one". 
It work in both direction. You can create the "non-geophysics" one instead.
Steps to follow: creates the categories with the range of pixel values 
in the "non-geophysics" image (or packed image), and the transformation 
formula for converting the integers to "real world" values. E.g.:
  new Category("Temperature", colors, 1, 256, 0.15, -5)
Uses pixel values 1 to 255 inclusive for temperature, to be translated 
into "real world" values using the formula 0.15*pixel - 5. Note that at 
this stage, we do not specify if pixels are really packed as integer in 
the range 1 to 255, or if they are already temperature °C to be packed. 
Category works in both ways.
Next, constructs a SampleDimension with all categories.
Finally, *before* to give the SampleDimension to GridCoverage, there is 
where you make a choice:
- If your original image is a geophysics one to be translated into
  a non-geophysics one using the *inverse* of the formula given in
  Category, give SampleDimension.geophysics(true) to the GridCoverage2D
  constructor.
- If your original image is a non-geophysics one to be translated into
  a geophysics one using the *direct* formula given in Category, give
  SampleDimension.geophysics(false) to GridCoverage2D constructor.
  Actually, you could omit geophysics(false) since it is the default.
If you give geophysics SampleDimensions to GridCoverage2D, you will get 
a geophysics coverage. If you give non-geophysics SampleDimensions to 
GridCoverage2D, you will get a non-geophysics coverage.
Does it work, or did I missed something?
	Martin.