/** * Retrieves an equivalent {@link ICRS} with authoritative axis ordering. * * NOTE: Due to the current state of the CRS database, this method is a hack. As soon as the CRS-DB has been * sanitized by removing the custom XY-variants of EPSG-CRS, it is not required anymore and should be removed. * * @param crs * CRS with authoritative or non-authoritative (forced XY) axis-ordering, must not be <code>null</code> * @return equivalent CRS with authoritative axis ordering, never <code>null</code> * @throws UnknownCRSException */ public static ICRS getAxisAwareCrs( final ICRS crs ) throws UnknownCRSException { if ( isAxisAware( crs ) ) { return crs; } for ( final String crsString : crs.getOrignalCodeStrings() ) { final String lowerCrsString = crsString.toLowerCase(); if ( lowerCrsString.startsWith( "epsg:" ) ) { final String epsgCode = lowerCrsString.substring( 5 ); return getAxisAwareCrs( epsgCode ); } } throw new RuntimeException( "Unable to determine axis-aware CRS variant for " + crs.getAlias() ); }