public static Coordinate mapToLayer(IMap map, ILayer layer, Coordinate coordInMapCrs) {
try {
MathTransform toLayer = layer.mapToLayerTransform();
double[] src = { coordInMapCrs.x, coordInMapCrs.y };
double[] dst = new double[2];
toLayer.transform(src, 0, dst, 0, 1);
return new Coordinate(dst[0], dst[1]);
} catch (IOException ex) {
throw new RuntimeException(ex);
} catch (TransformException ex) {
throw new RuntimeException(ex);