1

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

3
  • Hi. Welcome to GIS! I'm not quite sure I understand the question? Could you try and rephrase your problem?
    – Guy
    Commented Jun 26, 2015 at 20:49
  • Do you know what location this is supposed to be? With that information, we might be able to suggest some possible coordinate reference systems (ex. if in Russia, might be 3857).
    – mkennedy
    Commented Jun 26, 2015 at 22:41
  • Yes. It's supposed to be Moscow. Lat: 55.7500, Lon: 37.6167.
    – blutuu
    Commented Jun 28, 2015 at 12:11

2 Answers 2

2

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/

1

you can use something like this:

var newlonLat = new OpenLayers.LonLat(lon, lat).transform(map.getProjectionObject() , new OpenLayers.Projection("EPSG:4326"));

.transform( From projection, To projection)

But first you need to know what projection you want, in the example is EPSG:4326

References: Openlayers DOC

1
  • Would this help me transform this " Lat: 55.7500, Lon: 37.6167" into floats?
    – blutuu
    Commented Jun 28, 2015 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.