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 317627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:29:41+00:00 2026-05-12T08:29:41+00:00

I have a database of geocoded entries. I need to determine which two entries

  • 0

I have a database of geocoded entries. I need to determine which two entries are the furthest apart from a subset of the total entries. For example, I select a list of 10 entries then, from that list, determine which two places represent the greatest distance within that list.

I cannot wrap my head around how to approach this. I’ve considered using radians even, but nothing seems to meet the requirement.

FYI, LAMP stack going here…

  • 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-12T08:29:42+00:00Added an answer on May 12, 2026 at 8:29 am

    The following query will calculate the distance between all your points and return the two with the biggest distance:

    SELECT coor1.longitude as lon1,
           coor1.latitude as lat1,
           coor2.longitude as lon2,
           coor2.latitude as lat2,
           (ACOS(
             COS(RADIANS(coor1.latitude))  * 
             COS(RADIANS(coor1.longitude)) *
             COS(RADIANS(coor2.latitude))  *
             COS(RADIANS(coor2.longitude)) + 
             COS(RADIANS(coor1.latitude))  *
             SIN(RADIANS(coor1.longitude)) *
             COS(RADIANS(coor2.latitude))  *
             SIN(RADIANS(coor2.longitude)) +
             SIN(RADIANS(coor1.latitude))  * 
             SIN(RADIANS(coor2.latitude))
             ) * 6378                        --- Use 3963.1 for miles
           ) 
    AS DistanceKM
    FROM coordinates coor1,
         coordinates coor2
    WHERE NOT (coor1.longitude = coor2.longitude AND coor1.latitude = coor2.latitude)
    ORDER BY DistanceKM DESC
    LIMIT 1;                                 --- Only the biggest
    

    Now I recommending doing those calculations before hand and storing the result in a separate table.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have database in which data is imported from the other table. if data
Problem: I have an address field from an Access database which has been converted
I have database which has two tables post: id post_name post_desc files: file_id file_name
i have database with two values id and val so i want to ask
I have database, and in one the tables I need change the values of
I have an app in android that in a different thread from the UI(which
I have a database of addresses, all geocoded. What is the best way to
I have database backups taken from 2 machines(same database). ( about 75 tables) One
I'm storing responses from the google geocoded into my database. One such response has
The address I have is a concatenated results[1].formatted_address retrieved from a database containing 6

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.