Hello Thierry

The axis abbreviation is not a reliable way to determine the axis direction. In particular the x, y and z abbreviations can be for anything. Often, "x", "y" and "z" just means "the first axis", "the second axis" and "the third axis" regardless their direction. A more reliable way is to use the direction. In the test case that you provided, just replace all getAbbreviation() method calls by getDirection(). The return value is an AxisDirection object which works like an enumeration. Some enumeration values are AxisDirection.EAST and AxisDirection.NORTH.

Note that for polar projections, there is no such thing as "east" or "north" directions. From the north pole, all directions are oriented toward south. So the directions are things like "South along 90° meridian" and "South along 180° meridian". This is one reason why we can not commit x, y, z abbreviations to particular directions (an other reason is historical practice long before computer age).

Note also that the unit of measurement is not necessarily metres. It can also be foot or other units, depending on the CRS. Apache SIS provides tools for unit conversions if needed (that would be a topic for a separated email). Generally, each CRS can have its own axis abbreviations, directions, and units. The axis properties are defined in the EPSG database to match the national practice of the country that provides the CRS.

If you need a uniform axis order and units of measurement, an alternative approach (probably more efficient) would be to insert the following linebefore CRS.findOperation(sourceCRS, targetCRS):

   targetCRS = 
AbstractCRS.castOrCopy(targetCRS).forConvention(AxesConvention.NORMALIZED);

    Martin


Reply via email to