[GIS] OpenLayers Lat Lon Conversion

latitude longitudeopenlayers-2

I've been trying to figure this out, but have come up with nothing. I have this code:

....
var lat = 7486473; 
var lon = 4193332;
var lonlat = new OpenLayers.LonLat(lon, lat);
....

It uses floats for the lat/lon values. My issue is I don't know how to convert regular latitude/longitude coordinates into these numbers. I've searched for the answer, but I haven't been able to make sense of anything since I'm pretty new to GIS as this isn't my field.

The location given represents Moscow. 55.7500° N, 37.6167° E
Moscow, Coordinates

Best Answer

The lat/lon-Values 7486473 / 4193332 are pretty sure EPSG 3857 values which you need if you want to display your data on top of 3rd-party Background-Layers like Google or OSM.

Your other values 55.7500 / 37.6167 are in EPSG 4326. so they need to be reprojected to get their EPSG3857-Values.

You can transform them as @Joys mentioned or copy them from the map on epsg.io http://epsg.io/3857/map

To get an better idea of what needs to be transformed and what doesn't, just have a look at my jsfiddle:

http://jsfiddle.net/expedio/kLmg4uey/