Problem 2497. Distance between two GPS Coordinates

Created by Peter Cook in Community

A problem that arises when performing geographically weighted regression is determining the distance between GPS coordinates. GIS (geographical information system) data is usually reported as a function of latitude and longitude.

A common form of GIS data is a CSV file of latitude, longitude, z triples, where z is some quantity that varies with space.

As a prelude to interpolation, the distance between a given point and every other given point in an area needs to be calculated.

Given a set of GPS coordinates, return the distance (in miles) between each point and every point around it using the haversine formula ( ) and taking the radius of Earth to be 3959 miles.

See Test Suite for Examples

Solution Stats

57.89% Correct | 42.11% Incorrect
Last solution submitted on Apr 30, 2019

Problem Comments