Convert Lon Lat to XY in Openlayers 3
When you transform you always transform pair of points:
ol.proj.transform([23.4, 42.5], 'EPSG:4326','EPSG:3857');
(this transforms from EPSG 4326 to EPSG 3857; the coordinates are [lon, lat])
I was looking for this function too, and I have found it in some of the examples on their site.
You can use ol.proj.fromLonLat([19.062072, 47.473478])
.
http://openlayers.org/en/v3.13.1/apidoc/ol.proj.html#.fromLonLat