final GeometryFactory geometryFactory = commonFactory.getGeometryFactory(crs);
final CoordinateSystem cs = crs.getCoordinateSystem();
final int xIndex = getDirectedAxisIndex(cs, AxisDirection.EAST);
final Unit xUnit = getDirectedAxisUnit(cs, AxisDirection.EAST);
final int yIndex = getDirectedAxisIndex(cs, AxisDirection.NORTH);
final Unit yUnit = getDirectedAxisUnit(cs, AxisDirection.NORTH);
// HACK(jdc): need to determine the order of the axes...
/*int[] indices = CSUtils.getDirectedAxisIndices(
crs.getCoordinateSystem(),
new AxisDirection[] { AxisDirection.EAST, AxisDirection.NORTH });*/
//edited to use javax.measure.unit.Convertor
UnitConverter xConverter = xUnit.getConverterTo(unit);
UnitConverter yConverter = yUnit.getConverterTo(unit);
double[] lowerOrdinates = new double[crs.getCoordinateSystem().getDimension()];
lowerOrdinates[xIndex] = xConverter.convert(minx);
lowerOrdinates[yIndex] = yConverter.convert(miny);