# Calculating area volume from longitude, latitude and altitude

38 views (last 30 days)
hye wook Kim on 10 Sep 2021
Commented: hye wook Kim on 14 Dec 2021
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?

darova on 11 Sep 2021
• Convert spherical coordinates into cartesian using sph2cart
• Use alphaShape to build an object and calculate volume
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);