<!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><PRE id=line1><SPAN><SPAN class=000272521-23112012>you have to set your variable mercator to the right projection.</SPAN></SPAN></PRE><PRE><SPAN><SPAN class=000272521-23112012>from </SPAN>kml-pointtrack.js.php<SPAN class=000272521-23112012>:</SPAN>
</SPAN><SPAN>var mercator = new OpenLayers.Projection("EPSG:4326"); </SPAN><SPAN class=comment><!-- WGS84 --><BR></SPAN><SPAN>var geographic = new OpenLayers.Projection("EPSG:4326"); </SPAN><SPAN class=comment><!-- WGS84 --></SPAN><SPAN></SPAN></PRE></DIV>
<DIV><SPAN><SPAN class=000272521-23112012>it should be <BR></SPAN>var mercator = 
new OpenLayers.Projection("EPSG:<SPAN class=000272521-23112012>900913</SPAN>"); 
</SPAN></DIV><SPAN></SPAN><FONT size=2 face=Arial></FONT><FONT size=2 
face=Arial></FONT>
<DIV><BR><SPAN class=000272521-23112012><FONT size=2 
face=Arial>Arnd</FONT></SPAN></DIV>
<DIV><SPAN class=000272521-23112012></SPAN> </DIV>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>Von:</B> openlayers-users-bounces@lists.osgeo.org 
[mailto:openlayers-users-bounces@lists.osgeo.org] <B>Im Auftrag von </B>Riggi 
Valerio<BR><B>Gesendet:</B> Freitag, 23. November 2012 15:32<BR><B>An:</B> 
openlayers-users@lists.osgeo.org<BR><B>Betreff:</B> Re: [OpenLayers-Users] 
Display Coordinates<BR></FONT><BR></DIV>
<DIV></DIV>
<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 
style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; FONT: medium monospace; WHITE-SPACE: pre-wrap; ORPHANS: 2; LETTER-SPACING: normal; WORD-SPACING: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" 
class=webkit-html-attribute-name>center:</SPAN><SPAN 
style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; DISPLAY: inline !important; FONT: medium monospace; WHITE-SPACE: pre-wrap; 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"> 
</SPAN><SPAN 
style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; FONT: medium monospace; WHITE-SPACE: pre-wrap; ORPHANS: 2; LETTER-SPACING: normal; WORD-SPACING: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" 
class=webkit-html-attribute-name>new</SPAN><SPAN 
style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; DISPLAY: inline !important; FONT: medium monospace; WHITE-SPACE: pre-wrap; 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"> 
</SPAN><SPAN 
style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; FONT: medium monospace; WHITE-SPACE: pre-wrap; ORPHANS: 2; LETTER-SPACING: normal; WORD-SPACING: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" 
class=webkit-html-attribute-name>OpenLayers.LonLat(15.4386126995087,</SPAN><SPAN 
style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; DISPLAY: inline !important; FONT: medium monospace; WHITE-SPACE: pre-wrap; 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"> 
</SPAN><SPAN 
style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; FONT: medium monospace; WHITE-SPACE: pre-wrap; ORPHANS: 2; LETTER-SPACING: normal; WORD-SPACING: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" 
class=webkit-html-attribute-name>38.2423138618469).transform(geographic,</SPAN><SPAN 
style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; DISPLAY: inline !important; FONT: medium monospace; WHITE-SPACE: pre-wrap; 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"> 
</SPAN><SPAN 
style="WIDOWS: 2; TEXT-TRANSFORM: none; TEXT-INDENT: 0px; FONT: medium monospace; WHITE-SPACE: pre-wrap; ORPHANS: 2; LETTER-SPACING: normal; WORD-SPACING: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" 
class=webkit-html-attribute-name>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>