[geotk] Re: Mapping coordinate system axis order to i, j indiceson a map images

Jonathan Blower j.d.blower at reading.ac.uk
Tue Apr 20 05:53:11 EDT 2010


Hi Martin,

> Actually the most robust approach is to ensure that we never need to known if 
> axes are swapped/flipped or not, especially since non-affine transforms provide 
> no garantee that axes swapping/flipping do not vary with the position.

Agreed.  In ncWMS we have a HorizontalGrid object that specifies the mapping from grid to WGS84 lat/lon coordinates, rather like the ReferenceableGrid in ISO19123.  It's up to subclasses to specify how the mapping is done (in some very difficult cases it's essentially a look-up table!).  Geotoolkit then handles the transformation from lat/lon to the image CRS.  So we do the transformation in two steps, with lat/lon as a "common language" bridging the gap between Geotoolkit and general NetCDF coordinate systems.

In this system, efficiencies can be made (i.e. fewer transformations need to be performed) if grid axes are aligned with the axes of external CRSs, which is what has motivated my original question on this thread.

However, I'd be really interested to compare our method (in ncWMS) with Geotoolkit's NetCDF-reading code, particularly in terms of performance.  One worry I have about the Geotoolkit method (which is very neat by the way) is that the extraction of data from the NetCDF coverage is handled "under the hood" in Java2D.  Is it possible that the implementation will read the entirety of a high-resolution field in order to extract just a few grid cells for a low-resolution image?

Also, is the Geotk method essentially limited to affine transformations or would there be a way of handling arbitrary transformations?  Looking at the Java2D API, it seems that handling non-affined transformations might be difficult, but perhaps I've missed something.

We have found that it's most efficient to strike a balance between reading the whole field in a single operation and reading individual pixels in individual operations: see http://www.resc.rdg.ac.uk/trac/ncWMS/browser/trunk/src/java/uk/ac/rdg/resc/ncwms/cdm/DataReadingStrategy.java.

Where should I go to grab your NetCDF-reading code, and do you have a simple example I could work from?  I've had a quick look on the Geotk website but couldn't find much on NetCDF yet.

Thanks,
Jon

-----Original Message-----
From: geotoolkit-bounces at lists.osgeo.org [mailto:geotoolkit-bounces at lists.osgeo.org] On Behalf Of Martin Desruisseaux
Sent: 19 April 2010 18:58
To: geotoolkit at lists.osgeo.org
Subject: Re: [geotk] Re: Mapping coordinate system axis order to i, j indiceson a map images

Le 19/04/10 18:43, Jonathan Blower a écrit :
> My main question is - what happens if the transformation from real-world to grid coordinates is not affine?

Actually the most robust approach is to ensure that we never need to known if 
axes are swapped/flipped or not, especially since non-affine transforms provide 
no garantee that axes swapping/flipping do not vary with the position.

Once the axes swapping/flipped information is buried into the AffineTransform, 
there is often no need to extract them out of the transform. From that point, we 
try to design all the processing chain in terms of concatenations of 
MathTransform, without knowing if the transforms we are concatenating are affine.

The main points where we need to care about axes order/flipping are typically 
right at the moment where an image is read from a file, or when it is written in 
a particular format. For everything else (including rendering), we try to avoid 
explicit handling of axes swapping/flipping.

For example our renderer engine defines the CRS of the output device (we call 
that the "display CRS") and just ask the referencing module to figure out the 
transform from the coverage CRS to the display CRS.

	Regards,

		Martin
_______________________________________________
Geotoolkit mailing list
Geotoolkit at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/geotoolkit


More information about the Geotoolkit mailing list