Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

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 added a vector layer to my main map with the controls like the example from openlayers:

Now when I want to get the resulting lonlat from the point that was drawn I get strange results:

({id:"OpenLayers.Geometry.Point_81", x:6418264.3901563, y:7161906.3780079, 
      bounds:{left:6418264.3901563, bottom:7161906.3780079, right:6418264.3901563,

The main map is constructed like this:

map = new OpenLayers.Map( $('map'), {
    sphericalMercator: true,
    //maxResolution: '360/512',
    maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
    projection: "EPSG:900913",
    displayProjection: new OpenLayers.Projection("EPSG:4326"),
    tileOrigin: new OpenLayers.LonLat(-180, -90),
    controls: [new OpenLayers.Control.Navigation({dragPanOptions: {enableKinetic: true}}),
                   new OpenLayers.Control.MousePosition(),new OpenLayers.Control.Zoom()],

Can somebody give me a hint, it's probably an easy thing but I'm quite new to openlayers and javascript in general :-)

Something with the conversion of projection ?

share|improve this question
up vote 4 down vote accepted

this is not a strange result, it gives you coordinate as map.projection which you have defined in map options projection: "EPSG:900913"

try to use .transform method:

vectorLayers.features[1].geometry.transform(map.projection, map.displayProjection);

i hope it helps you...

share|improve this answer
SUPERB! I should've posted here much earlier, stuck on this for 48hours - solved in 5min. now Thank you very much. – jonas Sep 14 '12 at 13:18
you're welcome :) – Aragon Sep 14 '12 at 13:19

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.