Explicitly pass coordinate dimension before transforming

An `ol.Coordinate` may have more than 2 dimensions.  In cases where it does, the `ol.proj.transform` function needs to pass the number of dimensions to the underlying transform function (which works on flat coordinate arrays).

Fixes #2879.