I'm not sure what you are trying to do here - but
looking at http://maps.google.com for Reykjavík,
Iceland I get the following Lat/Lon
(64.13577516756123, -21.895751953125)
Getting this information from Google is very
handy - the way I do it is to make a browser
bookmark (I call mine G-Lat/Lon) that has the
"URL" -
javascript:void(prompt('',gApplication.getMap().getCenter()));
You could just paste that line into the browser
address line, but a bookmark is handy. Nice that
Google provides tools like this!
The above "URL" pops a dialog box with the
decimal latitude and longitude of the center of
the currently displayed map. The most common way
to pass around these coordinates is in decimal
degrees and of course, j makes it easy to
manipulate them -
ll =: (64.13577516756123, -21.895751953125)
1r360p1 * ll NB. converting degrees to radians
0.55969 _0.191076
NB. converting decimal degrees to Degrees Minutes Seconds
] dms =: 0 60 60 #: ll * 3600
64 8 8.7906
_22 6 15.293
] dll =: 1r3600 * 60 #. dms NB. and back to decimal degrees.
64.1358 _21.8958
dll -: ll
1
I was unclear on your LON1, but the above may help you find your way.
In general, there is a nice exposition on this
topic (with good links to discussions of accuracy
and comparison of technics) at:
http://en.wikipedia.org/wiki/Haversine_formula
I implemented the formulae from that page, and
was particularly pleased when coming to the
phrase, "One can then solve for d either by
simply applying the inverse haversine (if
available)"
haversine =: [: *: 1 o. 2 %~ ]
and of course, in j, the inverse is just
haversine^:_1
Very satisfying!
- joey
At 15:11 +0000 2009/03/30, Björn Helgason wrote:
>I guess because this is base 60 that trying three 60 on the left is worth a
>try
> 60 60 60#:3849
>1 4 9
> 60 60 60 #:_1317
>59 38 3
> 60 60 60 #:1317
>0 21 57
>
>Still it is 21 57 and not _21 _57 as I started out with
>
>
>2009/3/30 Björn Helgason <[email protected]>
>
>> One of the things I am trying to figure out is this conversion backI have
>>
> > LAT1=: 1r10800p1 * 60 #. 64 9 NB. Reykjavík
>> LON1=: 1r10800p1 * 60 #. _21 _57 NB. Reykjavík
>>
>> Ok I take this here
>> 60 #. _21 _57
>> 60 #. 64 9
>> 3849
>> 60 #. _21 _57
>> _1317
>>
>> Now I want thew original back
>> 180 60#:3849
>> 64 9
>>
>> Fine and now the other one
>> 90 60 #: _1317
>> 68 3
>>
>> Not so fine I guess I have to subtract 90 and 60
>> 68 3-90 60
>> _22 _57
>>
>> Close - should be _21 _57
>> Should I have subtracted 89 60?
>>
>> 68 3-89 60
> > _21 _57
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm