Andrea Aime a écrit :
For AbstractGridCoverage2DReader, it would be nice to know exactly
what's not working for you and eventually fix it on trunk.
My issues are:
Configuration interface expects a File input source
-------------------------------------------------------------
I'm not sure where the restriction come from, but we had to provide a dummy file
for every layer in order to get it working. GeoServer checks for file existence,
which make it impossible to use it if we don't give him a dummy file even if it
will be totally ignored by our code. It make configuration more tedious since
the client must browse through large data directory for nothing. Note:
AbstractGridCoverage2DReader has an ImageInputStream attribute, which is not
applicable to a database connection. It should be splitted in a really abstract
superclass, and have specialized subclasses working on ImageInputStream only
when wanted.
Needs an GridFormatFactorySpi instance for each layer
-------------------------------------------------------------
We were trapped in a "one GridFormatFactorySpi == one 'LAYER' parameter value"
relationship, partially because of the inability to pass a non-File input in the
configuration interface. This relationship is not applicable to a database where
a single GridFormat serves an arbitrary amount of layers. For every row added in
our "Layer" table in the database, we had to create a GridFormatFactorySpi
instance. In practice, it means that the client can not add any layer without
writting a new class and recompiling the code. I guess that we could have
avoided this constraint with some configuration interface work, but we though
that GeoServer configuration was scheduled for refactoring, so we prefer to wait
for this work to be done.
Attributes that should be part of decoding process
-------------------------------------------------------------
AbstractGridCoverage2DReader contains a lot of attributes that should be part of
the decoding process, not properties of a CoverageReader (e.g. crs, envelope,
coverage name, num overviews, raster2model, originalGridRange and more...). I
understand that they may be convenience during the decoding process, in which
case they should not be in the public API. Because those attributes are public
(protected actually), they looks like as if they had to be provided at
construction time. Actually experience suggest that AbstractGridFormat do not
work well in Geoserver if we don't provide at less the CRS and the Envelope near
the construction time. Of course we don't have this information at construction
time in practice.
Lack of encapsulation
-------------------------------------------------------------
AbstractGridCoverage2DReader and its friends (AbstractGridFormat, etc.) expose
totally and without any control all their internal working. The above-cited
attributes should be private so that the implementation can make sure that:
- They are cleared when the input source change.
- They are consistent (in current state, absolutly nothing garantee that
those attributes have the expected dimensions, chains consistently ("grid
range" --> "raster2model" --> "envelope" --> "crs"), etc.).
Current AbstractGridCoverage2DReader implementation do not applies encapsulation
principles, which increase the risk of bugs and reduce our ability to change the
code in the future without compatibility break. As a side note, we have heard of
users who abandonned GeoTools because the API is changing too much. The lack of
encapsulation in classes like AbstractGridCoverage2DReader increase our
exposition to this kind of situations.
Lack of javadoc
-------------------------------------------------------------
The Coverage I/O stuff has some mysteries and few javadoc explaining them. For
example why the "Crop" operation expects 2 envelopes? I would expect a Crop to
work with a single Envelope parameter value.
While reading some code, I feel like a geologist digging in the Earth's crust
and reading the Earth's history from the geologic layers. I had the feeling to
read a little bit of Class's history by seeing what looks like patchs applied
over patchs. For example CoverageUtilities.prepareSourceForOperation(...) had
many redundancies in its "if ... else" statements, testing again stuff that was
already tested differently before, maybe because some conditions were added at a
later stage without revisiting the big picture. I cleaned this little method on
trunk last week. My feeling (but I may be completly wrong) is that current
AbstractGridCoverage2DReader is in a similar situation.
For the GeoServer configuration interface, again, it would be
interesting to know what you were looking for so that the next config
and UI effort will take it into consideration.
The only thing we need is the parameter connection to a database and remove
everything else. No file to specify, no CRS and no Envelope to provide, no
format to select, not even any layer to declare - all this stuff is in the database.
The way to declare a layer is a little bit "CoverageFormat" specific. For
example in the case of postgrid, the user just need to push a "update this
layer" button. Postgrid will scan some known directories on the server, find any
new files he didn't know about before and update its database accordingly
(possibly asking some file-dependant question to the user).
So we need the ability to start from a blank sheet and put configuration options
that are totally different from what we would have for a classical 2D raster.
Anything reproducable that could be reported, analyzed and fixed?
As soon as the "WIDTH" and "HEIGHT" parameter values are smaller than the size
that the cropped image would have if it wasn't scaled, our image disaspear. I'm
not totally sure that the bug isn't ours, which is why we try our code through a
mini-WMS before to bother the mailing list.
My intuition is that some code somewhere performs a division using integer
arithmetic or some other arithmetic that round the result to zero when we should
have a fraction between 0 and 1.
As far as projection is concerned, a quick look in some code suggests that many
projection are performed back and forth, maybe more than necessary (but I need
more investigation to be sure). The result is that we get ProjectionException
for bounding box where some result should be possible. For example we are unable
to draw a Raster in Mercator projection over a world map in WGS84. I understand
that we can't project a WGS84 coordinates to Mercator if we are close to a pole,
but the converse should be possible - currently it is not. Again I need more
investigation on this issue, maybe fix some code in referencing and coverage module.
We need to struck a middle ground here too. My personal opinion on this
matter is that we miss the equivalent of DataStore for the coverage
land. We already see various cases of entities that could be see as
black box holder of coverages:
* a plain directory filled with coverage data in various formats
* a single complex file such as the netcdf or the hdf ones
* postgrid
* a remote WCS server (that is, if we're ever going to have a client
to talk with them)
* ArcSDE grids
* Oracle grids
A CoverageStore could be modelled against the WCS service interfaces the
same way we modelled DataStore against the WFS datastore interfaces.
Any interest in doing a common work in this direction, anyone?
I want to do that, it is on my schedule, but for now we are on a emergency mode.
For now it is scheduled for March to May 2008. But I known that a promized a
coverage I/O review for a very long time and delayed it for years...
Regards,
Martin