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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:22:59+00:00 2026-06-12T00:22:59+00:00

How do I find closest airport using longitude and latitude ? Any specific web

  • 0

How do I find closest airport using longitude and latitude ?

Any specific web services and any database to achieve ?

  • 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-06-12T00:23:01+00:00Added an answer on June 12, 2026 at 12:23 am
    1. You need a dataset with fields for the airport`s latitude and
      longitude
    2. Use the calculation for Great-Circle distance (GCD) as outlined on the page linked below

    Wikipedia article on GCD

    Please provide example code/specify the language if you would like further and more specific help

    CODE:

    Taken from another webpage (now defunct, used waybackmachine)

    using System;  
    namespace HaversineFormula  
    {  
        /// <summary>  
        /// The distance type to return the results in.  
        /// </summary>  
        public enum DistanceType { Miles, Kilometers };  
        /// <summary>  
        /// Specifies a Latitude / Longitude point.  
        /// </summary>  
        public struct Position  
        {  
            public double Latitude;  
            public double Longitude;  
        }  
        class Haversine  
        {  
            /// <summary>  
            /// Returns the distance in miles or kilometers of any two  
            /// latitude / longitude points.  
            /// </summary>  
            /// <param name=”pos1″></param>  
            /// <param name=”pos2″></param>  
            /// <param name=”type”></param>  
            /// <returns></returns>  
            public double Distance(Position pos1, Position pos2, DistanceType type)  
            {  
                double R = (type == DistanceType.Miles) ? 3960 : 6371;  
                double dLat = this.toRadian(pos2.Latitude - pos1.Latitude);  
                double dLon = this.toRadian(pos2.Longitude - pos1.Longitude);  
                double a = Math.Sin(dLat / 2) * Math.Sin(dLat / 2) +  
                    Math.Cos(this.toRadian(pos1.Latitude)) * Math.Cos(this.toRadian(pos2.Latitude)) *  
                    Math.Sin(dLon / 2) * Math.Sin(dLon / 2);  
                double c = 2 * Math.Asin(Math.Min(1, Math.Sqrt(a)));  
                double d = R * c;  
                return d;  
            }  
            /// <summary>  
            /// Convert to Radians.  
            /// </summary>  
            /// <param name="val"></param>  
            /// <returns></returns>  
            private double toRadian(double val)  
            {  
                return (Math.PI / 180) * val;  
            }  
        }  
    }  
    

    Pseudocode:

    This pseudocode should give you the answer you are looking for. I didn’t test this and the C# will probably have syntactic errors but the gist of it should be clear.

    /* Set parameters */
    Position currentPosition = new Position();
    Position airportPosition = new Position();
    Double minDistance = Double.MaxValue;
    String closestAirportName = "UNKNOWN";
    Haversine hv = new Haversine();
    
    /* Set current position, remains fixed throughout */
    currentPosition.Latitude = 0.000;
    currentPosition.Longitude = 0.000; 
    
    /* Compare distance to each airport with current location
    * and save results if this is the closest airport so far*/
    Foreach (airport in airports) {
        airportPosition = new Position(airport.Lat, airport.Lon);
        Double distanceToAirport = hv.Distance(currentPosition, airportPosition, DistanceType.Kilometers)
    
        if (distanceToAirport < minDistance) {
            minDistance = distanceToAirport
            closestAirportName = airport.Name
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a tool that will find the closest latitude/longitude position from a
I have a loop $(.box).find('.video, .print, .web').closest('.box').each(function (index) { $(this).delay(100 * index).fadeIn(300); }); This
I am trying to find the closest tr that also matches a specific class
I am developing a web application where I need to find the closest bus-stop
using jquery, how would i find the closest match in an array, to a
Are there any algorithms that would find the closest match to a string from
I am trying to find a closest match for a word by giving a
I am attempting to find the closest product to the given budget $array =
I am doing a project where I need to find the closest 10 markers
parentId=$(this).closest('tr').find('td:nth(6)')[0].textContent; I am trying to get ID from flexigrid column. It works fine in

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.