<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.19328"></HEAD>
<BODY bgColor=#ffffff text=#000000>
<DIV dir=ltr align=left><SPAN class=476375520-22112012><FONT color=#0000ff>your 
link</FONT></SPAN></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff><A 
href="http://www.intornoamessina.it/tracking/"><FONT face=Arial><FONT 
size=2>http://www.intornoamessina.it/tracking/</FONT></FONT></A></FONT></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial></FONT> </DIV>
<DIV><SPAN class=476375520-22112012><FONT color=#0000ff size=2 face=Arial>points 
to a map with the projection EPSG:900913.</FONT></SPAN></DIV>
<DIV><SPAN class=476375520-22112012><FONT color=#0000ff size=2 
face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><script 
src="kml-pointtrack.js.php?wgs84"></script></FONT></DIV>
<DIV><FONT color=#0000ff size=2 face=Arial><SPAN 
class=476375520-22112012>-></SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>    
map = new OpenLayers.Map({<BR>        div: 
"map",<BR>        projection: 
mercator,<BR>        displayProjection: 
geographic,<BR>        layers: 
[<BR>            new 
OpenLayers.Layer.OSM('Spherical 
Mercator'),            
<BR>            new 
OpenLayers.Layer.PointTrack("Tracks", {<BR></FONT></DIV>
<DIV dir=ltr align=left><SPAN class=476375520-22112012><FONT color=#0000ff 
size=2 face=Arial>The coordinates of MousePosition jumps as seen before. The 
projected coordinates are correct.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=476375520-22112012><FONT color=#0000ff 
size=2 face=Arial>The tricky part is</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=476375520-22112012><FONT color=#0000ff 
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=476375520-22112012><FONT color=#0000ff 
size=2 face=Arial>var geoCoor = lonLat.transform(geographic, 
mercator);</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=476375520-22112012><FONT color=#0000ff 
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=476375520-22112012><FONT color=#0000ff 
size=2 face=Arial>You have forgotten to clone the lonLat. The transformation 
changes the coordinates of lonLat to mercator!</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=476375520-22112012><FONT color=#0000ff 
size=2 face=Arial>So both variables geoCoor and lonLat hold the same projected 
coordinates.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=476375520-22112012><FONT color=#0000ff 
size=2 face=Arial>And OpenLayers.Util.getFormattedLonLat(lat); gets projected 
coordinates, that leads to a wrong formated output.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=476375520-22112012><FONT color=#0000ff 
size=2 face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=476375520-22112012><FONT color=#0000ff 
size=2 face=Arial>
<DIV dir=ltr align=left><SPAN class=476375520-22112012><FONT color=#0000ff 
size=2 face=Arial>This is the right way:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=476375520-22112012><FONT color=#0000ff 
size=2 face=Arial>var geoCoor = lonLat.clone().transform(geographic, 
mercator);</FONT></SPAN></DIV></FONT></SPAN></DIV><BR>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left><SPAN 
class=476375520-22112012><FONT color=#0000ff size=2 face=Arial>geoCoor gets 
projected coordinates without changing the coordinates of 
lonLat.</FONT></SPAN></DIV><SPAN class=476375520-22112012>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left><BR><FONT 
color=#0000ff size=2 face=Arial>Good luck,</FONT></DIV>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left><SPAN 
class=476375520-22112012><FONT color=#0000ff size=2 
face=Arial>Arnd</FONT></SPAN> </SPAN></DIV>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left><SPAN 
class=476375520-22112012><FONT color=#0000ff size=2 
face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left><SPAN 
class=476375520-22112012> </SPAN></DIV>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
</DIV>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left><FONT size=2 
face=Tahoma><B>Von:</B> Riggi Valerio [mailto:vash.84@virgilio.it] 
<BR><B>Gesendet:</B> Donnerstag, 22. November 2012 11:15<BR><B>An:</B> 
openlayers-users@lists.osgeo.org<BR><B>Cc:</B> 
arnd.wippermann@web.de<BR><B>Betreff:</B> Re: AW: [OpenLayers-Users] Display 
Coordinates<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV class=moz-cite-prefix>I corrected the code but still I don't understand a 
thing.. when I go on the WGS-84 map (<A 
href="http://www.intornoamessina.it/tracking/">http://www.intornoamessina.it/tracking/</A>) 
and I point the mouse at a certain point of coordinate -93.2735, 44.8349 the 
result is like 4613718.1118, 1718560.9374, should not be like the coordinates 
before?<BR><BR>Many Thanks<BR>Valerio<BR><BR>Il 21/11/2012 20:16, Arnd 
Wippermann ha scritto:<BR></DIV>
<BLOCKQUOTE cite=mid:5F57403BAF2B4531B0DEEE2ABCF8FAE0@pcawh2 type="cite">
  <META name=GENERATOR content="MSHTML 8.00.6001.19328">
  <DIV dir=ltr align=left><FONT face=Arial><FONT color=#0000ff><FONT 
  size=2>OpenLayers.Util.getFormattedLonLat(lat)<SPAN class=640170819-21112012> 
  is for formating geographic coordinates,</SPAN></FONT></FONT></FONT></DIV>
  <DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial>
  <DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
  class=640170819-21112012>but you pass projected coordinates to the function. 
  That's the reason for the strange output.</SPAN></FONT></DIV>
  <DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN 
  class=640170819-21112012></SPAN></FONT> </DIV></FONT></DIV>
  <DIV dir=ltr align=left><SPAN class=640170819-21112012><FONT color=#0000ff 
  size=2 face=Arial>Util.js:</FONT></SPAN></DIV>
  <DIV dir=ltr align=left><FONT face=Arial><FONT color=#0000ff><FONT 
  size=2>OpenLayers.Util.getFormattedLonLat = function(coordinate, axis, 
  dmsOption) {<BR>    if (!dmsOption) 
  {<BR>        dmsOption = 
  'dms';    //default to show degree, minutes, 
  seconds<BR>    }<BR> <BR> coordinate = 
  (coordinate+540)%360 - 180; // normalize for sphere being round<BR><SPAN 
  class=640170819-21112012>...</SPAN></FONT></FONT></FONT></DIV>
  <DIV dir=ltr align=left><FONT face=Arial><FONT color=#0000ff><FONT 
  size=2><SPAN class=640170819-21112012></SPAN></FONT></FONT></FONT> </DIV>
  <DIV dir=ltr align=left><FONT face=Arial><FONT color=#0000ff><FONT 
  size=2><SPAN class=640170819-21112012>Choose displayProjection: geographic 
  </SPAN></FONT></FONT></FONT><FONT face=Arial><FONT color=#0000ff><FONT 
  size=2><SPAN class=640170819-21112012>and if you want to output your mousemove 
  coordinates also in the projected 
  coordinates,</SPAN></FONT></FONT></FONT></DIV>
  <DIV dir=ltr align=left><FONT face=Arial><FONT color=#0000ff><FONT 
  size=2><SPAN class=640170819-21112012>you have to transform 
  them.</SPAN></FONT></FONT></FONT></DIV>
  <DIV dir=ltr align=left><FONT face=Arial><FONT color=#0000ff><FONT 
  size=2><SPAN class=640170819-21112012></SPAN></FONT></FONT></FONT> </DIV>
  <DIV dir=ltr align=left><FONT face=Arial><FONT color=#0000ff><FONT 
  size=2><SPAN 
  class=640170819-21112012>            
  formatOutput: function(lonLat) 
  {<BR>                
  var geoCoor = lonLat.clone().transform(geographic, 
  mercator);<BR>                
  var lat = lonLat.lat;<BR>...</SPAN></FONT></FONT></FONT></DIV>
  <DIV dir=ltr align=left><FONT face=Arial><FONT color=#0000ff><FONT 
  size=2><SPAN class=640170819-21112012></SPAN></FONT></FONT></FONT> </DIV>
  <DIV dir=ltr align=left><FONT face=Arial><FONT color=#0000ff><FONT 
  size=2><SPAN class=640170819-21112012></SPAN></FONT></FONT></FONT> </DIV>
  <DIV dir=ltr align=left><FONT face=Arial><FONT color=#0000ff><FONT 
  size=2><SPAN class=640170819-21112012>see:</SPAN></FONT></FONT></FONT></DIV>
  <DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><A 
  href="http://gis.ibbeck.de/ginfo/apps/OLExamples/OL212/PointTrack_Boaga_Projection.asp" 
  moz-do-not-send="true">http://gis.ibbeck.de/ginfo/apps/OLExamples/OL212/PointTrack_Boaga_Projection.asp</A></FONT></DIV>
  <DIV dir=ltr align=left> </DIV>
  <DIV dir=ltr align=left><SPAN class=640170819-21112012><FONT color=#0000ff 
  size=2 face=Arial>Regard,</FONT></SPAN></DIV>
  <DIV dir=ltr align=left><SPAN class=640170819-21112012><FONT color=#0000ff 
  size=2 face=Arial>Arnd</FONT></SPAN></DIV><BR>
  <DIV dir=ltr lang=de class=OutlookMessageHeader align=left>
  <HR tabIndex=-1>
  <FONT size=2 face=Tahoma><B>Von:</B> <A class=moz-txt-link-abbreviated 
  href="mailto:openlayers-users-bounces@lists.osgeo.org">openlayers-users-bounces@lists.osgeo.org</A> 
  [<A class=moz-txt-link-freetext 
  href="mailto:openlayers-users-bounces@lists.osgeo.org">mailto:openlayers-users-bounces@lists.osgeo.org</A>] 
  <B>Im Auftrag von </B>Riggi Valerio<BR><B>Gesendet:</B> Mittwoch, 21. November 
  2012 11:30<BR><B>An:</B> <A class=moz-txt-link-abbreviated 
  href="mailto:openlayers-users@lists.osgeo.org">openlayers-users@lists.osgeo.org</A><BR><B>Betreff:</B> 
  Re: [OpenLayers-Users] Display Coordinates<BR></FONT><BR></DIV>
  <DIV class=moz-cite-prefix>Cit.:<BR><SPAN 
  style="WIDOWS: 2; TEXT-TRANSFORM: none; BACKGROUND-COLOR: rgb(255,255,255); TEXT-INDENT: 0px; DISPLAY: inline !important; FONT: 13px Verdana, Geneva, Helvetica, Arial,
            sans-serif; WHITE-SPACE: normal; ORPHANS: 2; FLOAT: none; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px">Set 
  the displayProjection property when you create the map to the projection (not 
  the projection code) that you want the coordinates to be in.  (looks like 
  it should be a projection created from EPSG:4326) The lat/lon being passed 
  into the mousecontrol event will be in this projection. It look to me like you 
  are getting in projected coordinates but trying to use them as 
  lat/long.</SPAN><BR><BR>Done but the problem remains.<BR><BR>Il 20/11/2012 
  15:28, Riggi Valerio ha scritto:<BR></DIV>
  <BLOCKQUOTE cite=mid:50AB93A1.8080209@virgilio.it type="cite">Hi, I'm tryng 
    to display the coordinates on mouse over the map, on a WGS84 map and on a 
    Gauss-Boaga map but coordinate seems strange to me, is there some error? I'm 
    using the example bellow:<BR><BR>This is the <A 
    href="http://www.intornoamessina.it/tracking/index.php" 
    moz-do-not-send="true">WGS84 map</A> and this is the <A 
    href="http://www.intornoamessina.it/tracking/index.php?gauss" 
    moz-do-not-send="true">Gauss-Boaga Map</A><BR><BR>And this is the <B>example 
    code</B> I used:<BR><BR>    
    map.addControl(<BR>                
    new 
    OpenLayers.Control.MousePosition({<BR>                    
    prefix: '<div style=\"color: green; font-size: 14px; font-weight: bold; 
    background-color: white; width: 500px; text-align: left;\">Coordinate: 
    ',<BR>                    
    suffix: 
    '</div>',<BR>                    
    separator: ' | 
    ',<BR>                    
    numDigits: 
    2,<BR>                    
    emptyString: '<div style=\"color: red; font-size: 14px; font-weight: 
    bold; background-color: white; width: 500px; text-align: left;\">Mouse 
    non sulla 
    mappa.</div>'<BR>                
    })<BR>            
    );<BR>    map.events.register("mousemove", map, function(e) 
    {<BR>                
    var position = 
    this.events.getMousePosition(e);<BR>                
    OpenLayers.Util.getElement("coords").innerHTML = 
    position;<BR>            
    });<BR>    map.addControl(new 
    OpenLayers.Control.Attribution());<BR><BR><B>Thanks</B><B><BR></B><B>Valerio</B><BR><BR>
    <FIELDSET class=mimeAttachmentHeader></FIELDSET> <BR><PRE wrap="">_______________________________________________
Users mailing list
<A class=moz-txt-link-abbreviated href="mailto:Users@lists.osgeo.org" moz-do-not-send="true">Users@lists.osgeo.org</A>
<A class=moz-txt-link-freetext href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" moz-do-not-send="true">http://lists.osgeo.org/mailman/listinfo/openlayers-users</A>
</PRE></BLOCKQUOTE><BR></BLOCKQUOTE><BR></BODY></HTML>