Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an OpenLayers map with a settings like a below. All LatLon points are represented like a POINT(3684182 5207957). In a more usual form (for me) it looks like a (104.287422, 52.284126). How can I "convert" "POINT(…)" to this form?

projection: "EPSG:4326"
actualBounds: "0,0,4938083,5375780"
bounds: "0,0,9248768,9248768"
initCenterCoord: "3791668,5149639"
initCenterZoom: "5"
    bottom: -90
    left: -180
    right: 180
    top: 90
maxResolution: 36128
numZoomLevels: 10
resolution: 141.125
    bottom: 1185098
    left: -4938083
    right: 9876166
    top: 11936658
    cityy: 9248768
    hemisphere: "N"
    inverseflattering: 298.2571644
    majorsemiaxis: 6378137
    offsetx: -1902571
    offsety: -2422059
    scalex: 100
    scaley: -100
    shiftx: -41454992
    shifty: 583328750
    zone: 48

Update: Some JS examples about a conversion between a projections:

> var projWGS84 = new OpenLayers.Projection("EPSG:4326");
> var proj900913 = new OpenLayers.Projection("EPSG:900913");
> var point = new OpenLayers.LonLat(3684182, 5207957);
  lat: 5207957
  lon: 3684182
> point.transform(proj900913, projWGS84);
  lat: 5207957
  lon: 3684182
> point.transform(projWGS84, proj900913);
  lat: 5207957
  lon: 3684182

Update 2: PostGIS conversion from 900913 to 4326 do it wrong:

SELECT ST_AsText( ST_Transform( ST_GeometryFromText('POINT(3684182 5207957)', 900913) , 4326 ) );
 POINT(33.0955700007803 42.3128389015332)

Screeshot: enter image description here

share|improve this question
Thought: can these coordinates be measured from the boundaries of the map? – SvartalF Dec 9 '11 at 15:23
whatever projection your points are in it is not lat/lon - you'll need to check with your data provider to find out what it is. – iant Dec 9 '11 at 15:50
Well, it is a WKT data, it can be normally readed via the OpenLayers.Format.WKT().read() and showed on the map. All I need, is to convert it into another look. – SvartalF Dec 9 '11 at 16:01
Ugh… It was my bad, I've missed an one small function, which converts data to a normal view. When a self-answer timer will be turned off, I'll close this question. – SvartalF Dec 9 '11 at 16:16

There is a [geometry].tranform( [current_projection] , [desired_projection] ) function that you can use.

You will need to know what the current projection of the geomtry is (probably SRID ESPG:900913), and the projection you want (probably ESPG:4326).

The code would look something like this:

var projWGS84 = new OpenLayers.Projection("EPSG:4326");
var proj900913 = new OpenLayers.Projection("EPSG:900913");

var someGeom = originalGeom.transform(proj900913  , projWGS84 );

Alternatively when setting up your vector layer you can use something like this, or of course a combination of the two.

EDIT: Ive looked at your code and this seems to work for me:

var projWGS84 = new OpenLayers.Projection("EPSG:4326");
var proj900913 = new OpenLayers.Projection("EPSG:900913");

var point = new OpenLayers.LonLat(3684182, 5207957);
var point2 =  point.transform(proj900913, projWGS84);
share|improve this answer
The problem is that this data already in the WGS84 projection. Here is a link. And also, a transformation between a WGS84 and 900913 does not do anything. It is still a (3684182 5207957) – SvartalF Dec 9 '11 at 13:48
Can you put the code in your question please. – CatchingMonkey Dec 9 '11 at 13:51
Whoops, sorry. I've added examples into the question. – SvartalF Dec 9 '11 at 13:55
Well, I even took a screenshot: And also, updated a post with a PostGIS conversion example. – SvartalF Dec 9 '11 at 14:12
Whats the editor your using? – CatchingMonkey Dec 9 '11 at 14:28

I have had some problems converting from different projections previously. My approach has been to define all of the projections that I need at the top of a .js file so I am certain that they are, as I found the nomenclature confusing. The other issue I found was that no projection will occur, if a EPSG code that you reference does not exist.

//Define Projections
Proj4js.defs["EPSG:27700"]  = "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs";
Proj4js.defs["EPSG:4326"]   = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs";
Proj4js.defs["EPSG:900913"] = "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs";

Not sure if that is your problem, but it has helped me previously.

share|improve this answer
Well, nope. I had tried to use Javascript+OpenLayers, PostGIS and Python+pyproj (bindings to proj.4 library), and all results doesn't looks like a "Luke, you just need to convert it from EPSG:900913 to EPSG:4326". – SvartalF Dec 9 '11 at 14:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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