Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 436877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T20:31:19+00:00 2026-05-12T20:31:19+00:00

I have blocks of data associated with latitude/longitude values. I’d like to create a

  • 0

I have blocks of data associated with latitude/longitude values. I’d like to create a lookup key/hash value from the latitude/longitude value so it can be used as a lookup into a map or something similar.

I’m using negative values for West and South… therefore 5W, 10S is represented as -5, -10 in the program.

I’d like to be able to get the latitude/longitude values back from the key value if possible.

The derived value MUST be some sort of integer value.

I’m using C/C++ 🙂

Thanks, I’ll be happy to answer any questions!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T20:31:19+00:00Added an answer on May 12, 2026 at 8:31 pm

    You could also encode it in nicely into a 64-bit integer using some bit manipulation

    longitude ranges from -180 to 180 so needs a minimum of 9 bits.
    lattitude rangs from -90 to +90 so needs a minimum of 8 bits.
    minutes go from 0 to 60 so require 6 bits.
    same for seconds.

    9+12 = 21 bits for longitude and 20 bits for lattitude.

    For subsecond precision you can then use 11 bit fixed point. this gives you accuracy down to a 2048th of a second.

    SO to store a longitude or lattitude you could use a struct as follows

    struct ALatLong
    {
        int angle:9;
        int minutes:6;
        int seconds:6;
        int subSeconds:11;
    };
    
    struct LatAndLong
    {
        ALatLong longitude;
        ALatLong lattitude;
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some data coming from the hardware. Data comes in blocks of 32
I have a function that operates on 128-bit blocks of data from an arbitrary-length
I have blocks of data that I want to write in a txt, or
I have an application where I am reading and writing small blocks of data
I have a static initialization block where I read data from DB into certain
I have just started using the Data Access Application Block from microsoft. There are
I have an array which contains different blocks of data and i have to
In my new project, I have many dynamic data blocks on home page. for
I have a vba script which is supposed to copy data from one sheet
I have a data frame like this: GN SN a b a b a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.