<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">I was missing an "else if" on my code
      and the mercator was always setted to EPSG:900913, now it seems to
      work but the wgs-84 version dosen't center the map on the desired
      position:<br>
          <span class="webkit-html-attribute-name" style="font-family:
        monospace; font-size: medium; font-style: normal; font-variant:
        normal; font-weight: normal; letter-spacing: normal;
        line-height: normal; orphans: 2; text-align: start; text-indent:
        0px; text-transform: none; white-space: pre-wrap; widows: 2;
        word-spacing: 0px; -webkit-text-size-adjust: auto;
        -webkit-text-stroke-width: 0px;">center:</span><span
        style="color: rgb(0, 0, 0); font-family: monospace; font-size:
        medium; font-style: normal; font-variant: normal; font-weight:
        normal; letter-spacing: normal; line-height: normal; orphans: 2;
        text-align: start; text-indent: 0px; text-transform: none;
        white-space: pre-wrap; widows: 2; word-spacing: 0px;
        -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;
        display: inline !important; float: none;"> </span><span
        class="webkit-html-attribute-name" style="font-family:
        monospace; font-size: medium; font-style: normal; font-variant:
        normal; font-weight: normal; letter-spacing: normal;
        line-height: normal; orphans: 2; text-align: start; text-indent:
        0px; text-transform: none; white-space: pre-wrap; widows: 2;
        word-spacing: 0px; -webkit-text-size-adjust: auto;
        -webkit-text-stroke-width: 0px;">new</span><span style="color:
        rgb(0, 0, 0); font-family: monospace; font-size: medium;
        font-style: normal; font-variant: normal; font-weight: normal;
        letter-spacing: normal; line-height: normal; orphans: 2;
        text-align: start; text-indent: 0px; text-transform: none;
        white-space: pre-wrap; widows: 2; word-spacing: 0px;
        -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;
        display: inline !important; float: none;"> </span><span
        class="webkit-html-attribute-name" style="font-family:
        monospace; font-size: medium; font-style: normal; font-variant:
        normal; font-weight: normal; letter-spacing: normal;
        line-height: normal; orphans: 2; text-align: start; text-indent:
        0px; text-transform: none; white-space: pre-wrap; widows: 2;
        word-spacing: 0px; -webkit-text-size-adjust: auto;
        -webkit-text-stroke-width: 0px;">OpenLayers.LonLat(15.4386126995087,</span><span
        style="color: rgb(0, 0, 0); font-family: monospace; font-size:
        medium; font-style: normal; font-variant: normal; font-weight:
        normal; letter-spacing: normal; line-height: normal; orphans: 2;
        text-align: start; text-indent: 0px; text-transform: none;
        white-space: pre-wrap; widows: 2; word-spacing: 0px;
        -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;
        display: inline !important; float: none;"> </span><span
        class="webkit-html-attribute-name" style="font-family:
        monospace; font-size: medium; font-style: normal; font-variant:
        normal; font-weight: normal; letter-spacing: normal;
        line-height: normal; orphans: 2; text-align: start; text-indent:
        0px; text-transform: none; white-space: pre-wrap; widows: 2;
        word-spacing: 0px; -webkit-text-size-adjust: auto;
        -webkit-text-stroke-width: 0px;">38.2423138618469).transform(geographic,</span><span
        style="color: rgb(0, 0, 0); font-family: monospace; font-size:
        medium; font-style: normal; font-variant: normal; font-weight:
        normal; letter-spacing: normal; line-height: normal; orphans: 2;
        text-align: start; text-indent: 0px; text-transform: none;
        white-space: pre-wrap; widows: 2; word-spacing: 0px;
        -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;
        display: inline !important; float: none;"> </span><span
        class="webkit-html-attribute-name" style="font-family:
        monospace; font-size: medium; font-style: normal; font-variant:
        normal; font-weight: normal; letter-spacing: normal;
        line-height: normal; orphans: 2; text-align: start; text-indent:
        0px; text-transform: none; white-space: pre-wrap; widows: 2;
        word-spacing: 0px; -webkit-text-size-adjust: auto;
        -webkit-text-stroke-width: 0px;">mercator)</span><br>
      why?<br>
      <br>
      Many thanks<br>
      Valerio<br>
      <br>
      Il 22/11/2012 22:08, Phil Scadden ha scritto:<br>
    </div>
    <blockquote cite="mid:50AE9455.4070104@gns.cri.nz" type="cite">
      <pre wrap="">Okay, you have added displayProjection.
So looking at the formatOutput function, I see.
lonLat now comes into the function as lat/lon in 4326.
you convert to mercator
However lonLat.transform changes lonLat.

try
var geoCoor = lonLat.clone();
   geoCoor.transform(geographic, mercator);
var lat = lonLat.lat;
var long = lonLat.lon;
var ns = OpenLayers.Util.getFormattedLonLat(lat);
var ew = OpenLayers.Util.getFormattedLonLat(long,'lon');
return '<div style=\"color: green; font-size: 14px; font-weight: bold; 
background-color: white; width: 700px; text-align: left;\">Coordinate: ' 
+ ns + ', ' + ew + ' (' + (Math.round(geoCoor.lat * 10000) / 10000) + ', 
' + (Math.round(geoCoor.lon * 10000) / 10000) + ')' + '</div>';
}

Get used to using firebug or similar. It makes it easy to see what is 
going on. Put breakpoint in formatOutput and then watch the values.


Notice: This email and any attachments are confidential. If received in error please destroy and immediately notify us. Do not copy or disclose the contents.

_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/openlayers-users">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a>

</pre>
    </blockquote>
    <br>
  </body>
</html>