Convert Lat/Lon Decimal Degrees to Trigesimal Codes

  • Comments posted to this topic are about the item Convert Lat/Lon Decimal Degrees to Trigesimal Codes

  • Even if the Trigesimal codes are stored as CHAR(5), a DECIMAL(9,6) only takes up 5 bytes, as well.  The Trigesimal also requires reversal if you actually want to calculate distances.  I'm obviously missing something here because I see zero advantage to making this conversion.  Please elaborate.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Colour me simple, but why not use the Spatial Data Type for this?

    😎

     

  • I should have been more explicit.  The main advantage is people can communicate using (and short-term memorize) the trigesimal geocode much easier than the Lat/Lon DD Coordinates. The trigesimal geocode in theory could even be used as a Postal Code. Of course we can also store 8 characters instead of 10 to save space in the database; simply drop the last character from x_cd and y_cd.

    From the NAC (Natural Area Code) website (http://www.nacgeo.com/?page_id=11)

    "... an eight-character NAC is an ideal universal address for postal services, delivery services, emergency services and taxi services because it can specify an area less than 25 by 50 meters anywhere in the world."

    "... a ten-character NAC is a perfect property identity code for each property in the world, which specify a reference area less than 0.8 by 1.6 meters on a property anywhere in the world."

    What is true for the NAC is true for any trigesimal geocode system. This is good news because the NAC is heavily IP encumbered (which it shouldn't be IMHO). It uses '0123456789BCDFGHJKLMNPQRSTVWXZ' as a character set and I have '0123456789BCDFGHJKLMNPQRSTVWXY' in the SQL script; simply swap 'Y' for 'Z' to convert back.  You can use any character set you like, for example, '0123456789abcdefghijklmnopqrst' would be valid as well.  Using a set without vowels not only avoids 1/I, 0/O confusion, it means your geocode will never be a word, profane or otherwise.

    • This reply was modified 1 year, 11 months ago by  Todd M. Owens.
    • This reply was modified 1 year, 10 months ago by  Todd M. Owens.
    • This reply was modified 1 year, 10 months ago by  Todd M. Owens.
  • Ah... got it.  And, it's important to avoid vowels in such a thing or you can spell some pretty nasty words.  The same holds true for some of the numbers.  For example... SH1T.

    Thanks, for the explanation.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply