Hi all,<br><br>you could also check this <a href="http://openlayers.org/pipermail/dev/2009-February/004389.html">http://openlayers.org/pipermail/dev/2009-February/004389.html</a><br><br>Theirs function is a bit more advanced, as it takes correct decimal rounding into account,<br>
<br>hope it helps,<br><br>cheers<br><br><div class="gmail_quote">On Fri, Sep 4, 2009 at 8:48 PM, fsalas <span dir="ltr">&lt;<a href="mailto:fsalas@geocuba.cu">fsalas@geocuba.cu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Andreas , I test your solutions but openlayer<br>
<br>
show the standard coordinates format ej. -79.456,21.2365<br>
<br>
Why, the formatOutput don&#39;t affect ?<br>
<br>
..<br>
.<br>
.<br>
<br>
map.addControl(mp);<br>
<br>
Regards,<br>
salas.<br>
<div class="im"><br>
<br>
----- Original Message -----<br>
From: &quot;Andreas Hocevar&quot; &lt;<a href="mailto:ahocevar@opengeo.org">ahocevar@opengeo.org</a>&gt;<br>
</div><div><div></div><div class="h5">To: &quot;users&quot; &lt;<a href="mailto:users@openlayers.org">users@openlayers.org</a>&gt;<br>
Sent: Friday, September 04, 2009 9:13 AM<br>
Subject: Re: [OpenLayers-Users] How to change the display coordinates<br>
<br>
<br>
Please provide a valid email address, and post follow-up questions to<br>
the list.<br>
<br>
You want me to show you how to calculate minutes and seconds?<br>
<br>
Here are two functions from Mapbuilder  [1]:<br>
<br>
  /**<br>
   * Decimal to DMS conversion<br>
   */<br>
  convertDMS = function(coordinate, type) {<br>
    var coords = new Array();<br>
<br>
    abscoordinate = Math.abs(coordinate)<br>
    coordinatedegrees = Math.floor(abscoordinate);<br>
<br>
    coordinateminutes = (abscoordinate - coordinatedegrees)/(1/60);<br>
    tempcoordinateminutes = coordinateminutes;<br>
    coordinateminutes = Math.floor(coordinateminutes);<br>
    coordinateseconds = (tempcoordinateminutes - coordinateminutes)/(1/60);<br>
    coordinateseconds =  Math.round(coordinateseconds*10);<br>
    coordinateseconds /= 10;<br>
<br>
    if( coordinatedegrees &lt; 10 )<br>
      coordinatedegrees = &quot;0&quot; + coordinatedegrees;<br>
<br>
    if( coordinateminutes &lt; 10 )<br>
      coordinateminutes = &quot;0&quot; + coordinateminutes;<br>
<br>
    if( coordinateseconds &lt; 10 )<br>
      coordinateseconds = &quot;0&quot; + coordinateseconds;<br>
<br>
    coords[0] = coordinatedegrees;<br>
    coords[1] = coordinateminutes;<br>
    coords[2] = coordinateseconds;<br>
    coords[3] = this.getHemi(coordinate, type);<br>
<br>
    return coords;<br>
  }<br>
<br>
  /**<br>
   * Return the hemisphere abbreviation for this coordinate.<br>
   */<br>
  getHemi = function(coordinate, type) {<br>
    var coordinatehemi = &quot;&quot;;<br>
    if (type == &#39;LAT&#39;) {<br>
      if (coordinate &gt;= 0) {<br>
        coordinatehemi = &quot;N&quot;;<br>
      }<br>
      else {<br>
        coordinatehemi = &quot;S&quot;;<br>
      }<br>
    }<br>
    else if (type == &#39;LON&#39;) {<br>
      if (coordinate &gt;= 0) {<br>
        coordinatehemi = &quot;E&quot;;<br>
      } else {<br>
        coordinatehemi = &quot;W&quot;;<br>
      }<br>
    }<br>
<br>
    return coordinatehemi;<br>
  }<br>
<br>
Now this is what you could do:<br>
<br>
var mp = new OpenLayers.Control.MousePosition({<br>
   formatOutput: function(lonLat) {<br>
       var markup = convertDMS(lonLat.lat, &quot;LAT&quot;);<br>
       markup += &quot; &quot; + convertDMS(lonLat.lon, &quot;LON&quot;);<br>
       return markup<br>
   }<br>
});<br>
<br>
Regards,<br>
Andreas.<br>
<br>
[1]<br>
<a href="http://svn.codehaus.org/mapbuilder/trunk/mapbuilder/lib/widget/CursorTrack.js" target="_blank">http://svn.codehaus.org/mapbuilder/trunk/mapbuilder/lib/widget/CursorTrack.js</a><br>
<br>
fsalas wrote:<br>
&gt; Thanks Andreas for your cooperations,<br>
&gt;<br>
&gt; but I have one doubt about How I use your function<br>
&gt;<br>
&gt; Is this possible send me one example about?<br>
&gt;<br>
&gt; Best Regards<br>
&gt;<br>
&gt; Salas<br>
&gt;<br>
&gt; ----- Original Message ----- From: &quot;Andreas Hocevar&quot;<br>
&gt; &lt;<a href="mailto:ahocevar@opengeo.org">ahocevar@opengeo.org</a>&gt;<br>
&gt; To: &quot;fsalas&quot; &lt;<a href="mailto:fsalas@geocuba.cu">fsalas@geocuba.cu</a>&gt;<br>
&gt; Cc: &lt;<a href="mailto:users@openlayers.org">users@openlayers.org</a>&gt;<br>
&gt; Sent: Friday, September 04, 2009 3:38 AM<br>
&gt; Subject: Re: [OpenLayers-Users] How to change the display coordinates<br>
&gt;<br>
&gt;<br>
&gt;&gt; fsalas wrote:<br>
&gt;&gt;&gt; Hi , I need to change the display coordinates in degree minutes and<br>
&gt;&gt;&gt; second format example (NE 50 20´ 23´´ )<br>
&gt;&gt;<br>
&gt;&gt; Just configure your MousePosition control with a custom formatOutput<br>
&gt;&gt; function:<br>
&gt;&gt;<br>
&gt;&gt; var mp = new OpenLayers.Control.MousePosition({<br>
&gt;&gt;    formatOutput: function(lonLat) {<br>
&gt;&gt;        var markup = &quot;&lt;your output markup here&gt;&quot;;<br>
&gt;&gt;        return markup<br>
&gt;&gt;    }<br>
&gt;&gt; });<br>
&gt;&gt;<br>
&gt;&gt; Regards,<br>
&gt;&gt; Andreas.<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; Andreas Hocevar<br>
&gt;&gt; OpenGeo - <a href="http://opengeo.org/" target="_blank">http://opengeo.org/</a><br>
&gt;&gt; Expert service straight from the developers.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;<br>
&gt;<br>
&gt; ___________________________________<br>
&gt; Dirección de Comunicaciones<br>
&gt; Grupo Empresarial GEOCUBA<br>
&gt; Este mensaje esta libre de virus. Revisado por Kaspersky Antivirus<br>
&gt; ----------------------------------------------------------------------<br>
&gt; Definition count:  2495798<br>
&gt; Definition date:  9/4/2009<br>
&gt; SecurityPlus version: 3.0.5<br>
&gt;<br>
&gt;<br>
&gt;<br>
<br>
<br>
--<br>
Andreas Hocevar<br>
OpenGeo - <a href="http://opengeo.org/" target="_blank">http://opengeo.org/</a><br>
Expert service straight from the developers.<br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br>
<a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
<br>
<br>
___________________________________<br>
Dirección de Comunicaciones<br>
Grupo Empresarial GEOCUBA<br>
Este mensaje esta libre de virus.<br>
Revisado por Kaspersky Antivirus<br>
----------------------------------------------------------------------<br>
Definition count:  2495798<br>
Definition date:  9/4/2009<br>
SecurityPlus version: 3.0.5<br>
<br>
<br>
<br>
</div></div><div><div></div><div class="h5">_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br>
<a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Ivan Grcic<br>