OpenLayers Projections.

Posted by Jenny on Stack Overflow See other posts from Stack Overflow or by Jenny
Published on 2010-04-09T13:18:52Z Indexed on 2010/04/09 13:23 UTC
Read the original article Hit count: 424

Filed under:
|

I can succesfully do:

point.transform(new OpenLayers.Projection("EPSG:900913"), new OpenLayers.Projection("EPSG:4326"));

To a point that is in the google format (in meters), but when I want to do the reverse:

point.transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"));

to a point that is in 4326 (regular lat/lon format), I am having some issues.

Any negative value seems to become NaN (not a number) when I do the transformation. Is there something about the transformation in reverse that I don't understand?

Edit: Even worse, when I have no negative values, the coordinates seem off. I am getting the coordinates by drawing a square on the screen, then saving those coordinates to a database and loading them later. I can draw a square near the tip of africa (positive coordinates), and then when it loads it's near the top of africa, in the atlantic ocean. I'm definitely doing something wrong....

© Stack Overflow or respective owner

Related posts about openlayers

Related posts about map