Problem 2497. Distance between two GPS Coordinates
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 ( http://en.wikipedia.org/wiki/Haversine_formula ) and taking the radius of Earth to be 3959 miles.
See Test Suite for Examples
Solution Stats
Problem Comments
-
4 Comments
Show
1 older comment
Peter Cook
on 14 Aug 2014
Updated. Thank you for the feedback
Jose Matos
on 20 May 2022
Is the test suite expecting a 19x19 array? Because when I submit my solution with a 19x19 array the test suite fails and I get the message: "Arrays have incompatible sizes for this operation."
Dyuman Joshi
on 20 May 2022
The first test suite was not defined for the user. It has been updated now.
Solution Comments
Show commentsGroup

Computational Geometry III
- 20 Problems
- 9 Finishers
- LASER Tracker - Mirror Distance and Angle
- Distance between two GPS Coordinates
- Spherical surface triangulation
- Do the line-segments intersect?
- Esoteric Trigonometry
- LASER Tracker - Mirror Distance and Angle
- Do the line-segments intersect?
- Spherical surface triangulation
- Parallel vectors
- Vector parallel to plane?
- distance to a straight line (2D) given any 2 distinct points on this straight line
- Slicing the cube
- Pairwise Euclidean Distance
- Wayfinding 1 - crossing
- Wayfinding 2 - traversing
- Wayfinding 3 - passed areas
- Avalaible area: wall construction
- rectangle in circle
- Distance between two GPS Coordinates
- Cut an orange
- Packing oranges - one layer
- Radiation Heat Transfer — View Factors (1)
- Radiation Heat Transfer — View Factors (2)
- Radiation Heat Transfer — View Factors (3)
- Esoteric Trigonometry
Problem Recent Solvers33
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!