Clear Filters
Clear Filters

Calculating area volume from longitude, latitude and altitude

19 views (last 30 days)
Hello! I'm trying to calculate the volume of airspace(3d polygon) from its longitude, latitude and altitude.
The polygon's vertices are given with longitude and latitude (ex. [128 129 129 128 128], [37 37 38 38 37])
and its altitude ranging from 1000~5000 feet.
How can I get the volume of this 3d polygon?

Accepted Answer

darova on 11 Sep 2021
  • Convert spherical coordinates into cartesian using sph2cart
  • Use alphaShape to build an object and calculate volume
Walter Roberson
Walter Roberson on 18 Sep 2021
You need to change the 1000 and 5000 to "radius of the Earth in that area, in feet, plus this".
Latitude at 37, Earth radius at sea level: 3958.404 miles
Latitude at 38, Earth radius at sea level: 3958.18 miles
That is a decrease of
format long g
(3958.404 - 3958.18) * 5280
ans =
a bit over 1000 feet. So 1182.72 feet at 38 degrees (which is within the airspace) would be at sea level at 37 degrees (and so not in the airspace.)
So, you cannot treat the base of the airspace as flat: the curvature difference is equal to approximately 1/4 of the difference in altitudes between the 1000 and 5000 foot level.
That page gives a radius equation that it might be useful to integrate over.
latitude B, radius R, radius at equator r1, radius at pole r2
R = √ [ (r1² * cos(B))² + (r2² * sin(B))² ] / [ (r1 * cos(B))² + (r2 * sin(B))² ]
Integrate altitude + R over altitude and latitude in radians, and multiply by radians spanned by longitude, to get volume.
hye wook Kim
hye wook Kim on 14 Dec 2021
Thank you for your help! @Walter Roberson.
As you said, I'm trying to solve this problem using the triplet integral (integral3 in matlab).
and I got 3 questions as follows;
Q1. How to calculate the volume in mile unit? (ex. 1000 nm3)
Q2. Does R need to be calculated in the loop for every latitude?
Q3. how to construct formula for integral3 to apply your recommand; 'Integrate altitude + R over altitude and latitude in radians, and multiply by radians spanned by longitude'.
This is the code that I wrote and seems to show wrong answer...
%% Coordinates(Lat,Lon,Alt) of Target Airspace
Latitude = [128 129 129 128 128]; % Degree
Longitude = [37 37 38 38 37]; % Degree
Bottom_Altitude = distdim(1000,'feet','nauticalmiles'); % Convert FT to NM
Top_Altitude = distdim(5000,'feet','nauticalmiles'); % Convert FT to NM
%% Get Centroid coordinates of Target Airspace
polyin = polyshape(Latitude, Longitude);
[centroid_latitutde, centroid_longitude] = centroid(polyin);
%% Get Radius of the Earth in target airspace
r1 = 3963.191; % Earth's radius (nm) at sea level at the EQUATOR.
r2 = 3949.903; % Earth's radius (nm) at sea level at the POLES.
B = centroid_latitutde; % Latitude of target airspace's centroid.
R = sqrt(((r1^2*cos(B))^2+(r2^2*sin(B))^2)/((r1*cos(B))^2+(r2*sin(B))^2)); % Earth's radius (nm) at sea level from Target centroid
%% Get Spherical Coordinates from Lat,Lon,Alt
min_rho = Bottom_Altitude + R; max_rho = Top_Altitude + R; % Height (nm) from the Earth's center.
min_phi = deg2rad(min(Latitude)); max_phi = deg2rad(max(Latitude)); % Latitude
min_theta = deg2rad(min(Longitude)); max_theta = deg2rad(max(Longitude)); % Longitude
%% Apply Triplet Integral to get the volume
vol_fun = @(rho,phi,theta) rho.*phi.*theta;
vol_Boundary = integral3(vol_fun,min_rho,max_rho,min_phi,max_phi,min_theta,max_theta);

Sign in to comment.

More Answers (0)


Find more on Earth and Planetary Science in Help Center and File Exchange


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!