// Loop through all of the axes until you find the one that is
// probably the upward axis.
//
for (int i = 0; i < numDimensions; i++) {
CoordinateSystemAxis axis = crs.getCoordinateSystem().getAxis(i);
AxisDirection axisDirection = axis.getDirection();
if (axisDirection.equals(AxisDirection.DISPLAY_UP)
|| axisDirection.equals(AxisDirection.EAST_NORTH_EAST)
|| axisDirection.equals(AxisDirection.NORTH)
|| axisDirection.equals(AxisDirection.NORTH_EAST)
|| axisDirection.equals(AxisDirection.NORTH_NORTH_EAST)
|| axisDirection.equals(AxisDirection.NORTH_NORTH_WEST)
|| axisDirection.equals(AxisDirection.NORTH_WEST)
|| axisDirection.equals(AxisDirection.ROW_POSITIVE)
|| axisDirection.equals(AxisDirection.UP)
|| axisDirection.equals(AxisDirection.WEST_NORTH_WEST)) {
return i;
}
}
//
// If not found yet, find one with name Northing or y and assume
// it is up.
//
for (int i = 0; i < numDimensions; i++) {
CoordinateSystemAxis axis = crs.getCoordinateSystem().getAxis(i);
String axisName = axis.getName().toString().toUpperCase();
if (axisName.equals("Y") || axisName.equals("NORTHING")
|| axisName.contains("NORTHING")) {
return i;
}
}