Vincenty Ellipsoid Great Circle Distance in R (Example)
In this article, I’ll show how to compute a Vincenty ellipsoid great circle distance in R.
The tutorial consists of the following content:
Let’s dive right in!
Creating Example Data
At the start, let’s create some example data in R:
my_points <- matrix(c(81.25798, 73.81277, # Create longitude/latitude matrix 14.91254, 18.18145), nrow = 2) colnames(my_points) <- c("longitude", "latitude") rownames(my_points) <- c("pt_1", "pt_2") my_points # Print longitude/latitude matrix

Table 1 shows the structure of our exemplifying data: It consists of two longitude and latitude points.
Example: Calculate Vincenty Ellipsoid Great Circle Distance Using distVincentyEllipsoid() Function of geosphere Package
In this example, I’ll illustrate how to calculate the Vincenty ellipsoid great circle distance in R.
For this, we first need to install and load the geosphere package:
install.packages("geosphere") # Install geosphere package library("geosphere") # Load geosphere package
Now, we can apply the distVincentyEllipsoid function of the geosphere package to calculate the Vincenty ellipsoid distance of our two geospatial points:
my_dist <- distVincentyEllipsoid(my_points) # Calculate Vincenty ellipsoid distance my_dist # Print Vincenty ellipsoid distance # [1] 872988
The geographical distance between our two data points according to the Vincenty formula is 872988.
Video & Further Resources
I have recently published a video on my YouTube channel, which explains the contents of this tutorial. You can find the video below:
The YouTube video will be added soon.
Furthermore, you might read some of the other articles of my homepage. You can find a selection of articles about distance metrics below:
- Haversine Great Circle Distance
- Law of Cosines Great Circle Distance
- Meeus Great Circle Distance
- Distance Along Rhumb Line
- Vincenty Sphere Great Circle Distance
- Geospatial Distance Between Two Points
- Introduction to R Programming
To summarize: This article has shown how to calculate a Vincenty ellipsoid distance in R programming. If you have further questions and/or comments, let me know in the comments.
Subscribe to the Statistics Globe Newsletter
Get regular updates on the latest tutorials, offers & news at Statistics Globe.
I hate spam & you may opt out anytime: Privacy Policy.
Thank you!
Welcome to the Statistics Globe newsletter. From now on, I’ll send you regular emails about statistics, data science, AI, and programming with R and Python.
I’m Joachim Schork. On this website, I provide statistics tutorials as well as code in Python and R programming.
Statistics Globe Newsletter
Get regular updates on the latest tutorials, offers & news at Statistics Globe. I hate spam & you may opt out anytime: Privacy Policy.
Thank you!
Please check your email inbox and click the confirmation link to complete your subscription. If you don’t see the email within a few minutes, please also check your spam/junk folder.







2 Comments. Leave new
What is the default units in which we get the distance? Is it in m or km?
Hey Sudeshna,
You can read more about that in the help documentation of the distVincentyEllipsoid function by executing ?distVincentyEllipsoid in the RStudio console.
This is a quote from the help documentation: “Distance value in the same units as the ellipsoid (default is meters)”
I hope that helps!
Joachim