On 23/06/2009, Mike Williams <[email protected]> wrote:
>
>  Wasn't it Barry Hunter who wrote:
>  >
>
>  >------------------
>  >        lonSign = lonSign = 1
>  >
>  >         if(aLatLon[2]=="S"){
>  >                 latSign=-1;
>  >         }
>  >         if(aLatLon[5]=="W"){
>  >                 lonSign=-1;
>  >        }
>  >
>  >  var lat=latSign*(aLatLon[0]+(aLatLon[1]/60))
>  >  var lon=lonSign*(aLatLon[3]+(aLatLon[4]/60))
>  >
>  >...
>  >  map.setCenter(new GLatLng(parseFloat(lat), parseFloat(lon),true),5);
>  >------------------
>  >
>  >is how I would do it..
>
>
> but aLatLon[0] is a String, so that forces the "+" to be considered to
>  be string concatenation rather than addition, and produces the wrong
>  result.

ah ok, then need a few more parseInt(x,10) etc on the input. (not on
the output like now :)



>
>  For example:
>    javascript:alert( -1 * ("35" +("27"/60)))
>  outputs -350.45 instead of 35.45.
>
>
>  --
>
> Mike Williams
>  http://econym.org.uk/gmap
>
>
>
>  >
>


-- 
Barry

- www.nearby.org.uk - www.geograph.org.uk -

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to