(keitai-l) Re: AU GPS: Got a new phone, and now its not working...

From: Ben Hutchings <ben_at_decadentplace.org.uk>
Date: 12/29/03
Message-ID: <[email protected]>
Christian Anderson wrote:
> I got a new phone last week, and just realized that the url the GPS spits
> out is a little different from my old Toshiba. I used to get a url like:
> <http://www.at-navi.com/map/checkMap.jsp?
> datum=0&unit=0&lat=+>

That probably corresponds to 43 11'10.42" N 140 47'36.26" E.

> But now I get something like:
> <http://walk.eznavi.jp/map/?
> datum=0&unit=1&lat=+42.84779&lon=+140.71558&fm=2>

That probably corresponds to 42.84779 N 140.71558 E.

> Try clicking on them and see what you get. The first one works (from my old
> keitai), but the second one gives a broken image where the map was supposed
> to be.

The first one redirects me to some kind of default page.

> So anyway, I tried to be creative and replace the walk.eznavi thing with the
> at.navi.com part up to the ? mark, but that didn't work because the way the
> coordinates are written are different. I tried like and
> in the at-navi url, but that produced something out in the
> middle of the ocean.
> Anyone know a work around for this? My new phone is awesome except for this
> problem which is mucking up my moblog.

I think you need to convert from decimal degrees to degrees, minutes
and seconds.  Try going to <http://www.at-navi.com/map/checkMap.jsp?

The conversion would be (in Python; hopefully the comments are
enough to explain it):

def degrees_to_dms_string(deg):

    # Separate out the sign.
    if deg < 0.0:
        sign = '-'
        deg = -deg
        sign = '+'

    # Convert to an integer to avoid inconsistent rounding later.
    # The least significant digit of the result corresponds to
    # centiseconds so multiply the number accordingly.  Note that
    # int rounds towards zero.
    csec = int(deg * 60.0 * 60.0 * 100.0 + 0.5)

    # Split up into the four components.  divmod calculates
    # quotient and remainder simultaneously.
    sec, csec = divmod(csec, 100)
    min, sec = divmod(sec, 60)
    deg, min = divmod(min, 60)

    # Convert the four components and sign into a string.  The
    # % operator on strings works like C's sprintf function.
    return '%s%d.%02d.%02d.%02d' % (sign, deg, min, sec, csec)

Ben Hutchings
Life would be so much easier if we could look at the source code.
Received on Mon Dec 29 23:41:12 2003