visualize aircraft line-凯发k8网页登录
this example shows how to compute and visualize the line-of-sight visibility of an aircraft from a ground location over terrain. first, import terrain data for a region and apply it to a 3-d geographic globe. then, perform point-to-point visibility analysis from a ground location to a simulated flight path, and display the results on a 3-d geographic globe. finally, perform point-to-area visibility analysis from the ground location corresponding to aircraft flying at constant altitude, and display the results on a 2-d geographic axes.
use line-of-sight analysis for ground-to-air scenarios where unobstructed visibility is important, such as for radar surveillance, communications, and uav path planning. this example applies the analysis to radar surveillance for an airport.
import terrain data
specify a dted-format terrain file to use for data analysis and 3-d visualization. the terrain file was downloaded from the "srtm void filled" data set available from the united states geological survey (usgs).
dtedfile = "n39_w106_3arc_v2.dt1"; attribution = "srtm 3 arc-second resolution. data available from the u.s. geological survey.";
import dted file data into the workspace as an array and a geographic raster reference object, specifying the return type as double so that the data works with all analysis functions.
[zterrain,rterrain] = readgeoraster(dtedfile,"outputtype","double");
view the geographic limits and sample resolution of the terrain data by accessing properties of the geographic raster reference object. the limits for the file correspond to the region around boulder, colorado, us, and the resolution corresponds to the dted level-1 format, which has sample resolution of 3 arc seconds, or about 90 meters.
latlim = rterrain.latitudelimits; lonlim = rterrain.longitudelimits; latspc = rterrain.samplespacinginlatitude; lonspc = rterrain.samplespacinginlongitude; disp("latitude limits of terrain: " mat2str(latlim) newline ... "longitude limits of terrain: " mat2str(lonlim) newline ... "terrain resolution in latitude: " latspc*3600 " arc seconds" newline ... "terrain resolution in longitude: " lonspc*3600 " arc seconds")
latitude limits of terrain: [39 40] longitude limits of terrain: [-106 -105] terrain resolution in latitude: 3 arc seconds terrain resolution in longitude: 3 arc seconds
visualize aircraft trajectory line-of-sight on a 3-d map
create geographic globe with custom terrain
add custom data with the dted file for use with 3-d visualization.
addcustomterrain("southboulder",dtedfile,"attribution",attribution)
specify the custom terrain with a new geographic globe.
fig = uifigure; g = geoglobe(fig,"terrain","southboulder");
view radar ground location
define a radar ground location at rocky mountain metropolitan airport. the radar is mounted on a tower 10 meters above the ground. the radar altitude is the sum of the ground elevation and the radar tower height, referenced to mean sea level.
rdrlat = 39.913756; rdrlon = -105.118062; rdrtowerht = 10; rdralt = 1717 rdrtowerht;
plot the radar location on the geographic globe.
geoplot3(g,rdrlat,rdrlon,rdralt,"co", ... "linewidth",6, ... "markersize",1)
simulate aircraft trajectory
simulate the trajectory of an aircraft circling over the mountains.
define the center location of a circling aircraft.
tlat0 = 39.80384; tlon0 = -105.49916; tht0 = 3000;
define trajectory waypoints for the aircraft using east-north-up (enu) cartesian coordinates. specify a curve with a radius of 5 km (5000 m) and a vertical offset of 1 km (1000 m) over 1.5 revolutions. then, convert the enu coordinates to geodetic coordinates that are referenced to the wgs84 ellipsoid.
azs = 1:540; r = 5000; [x,y] = pol2cart(deg2rad(azs),r); z = linspace(0,1000,numel(azs)); wgs84 = wgs84ellipsoid; [tlat,tlon,tht] = enu2geodetic(x,y,z,tlat0,tlon0,tht0,wgs84);
view aircraft trajectory over terrain
plot the aircraft trajectory on the geographic globe. the default view, or camera position, is overhead and oriented down.
hold(g,"on") traj = geoplot3(g,tlat,tlon,tht,"y", ... "heightreference","ellipsoid", ... "linewidth",3);
view the 3-d terrain and radar location from a distance by changing the camera position and rotation angles.
campos(g,39.77114,-105.62662,6670) camheading(g,70) campitch(g,-12)
compute line-of-sight visibility with aircraft trajectory
compute line-of-sight visibility with the los2
function and the dted data.
the los2
function supports either orthometric height (height above mean sea level) or height above ground level. convert the aircraft trajectory heights from ellipsoidal height to orthometric height. then, compute the line-of-sight from the airport radar location to each aircraft trajectory waypoint and convert the results to a logical array.
numwaypts = numel(tlat); isvis = zeros(1,numwaypts); talt = tht - egm96geoid(tlat,tlon); for k = 1:numwaypts isvis(k) = los2(zterrain,rterrain,rdrlat,rdrlon,tlat(k),tlon(k),rdralt,talt(k),"msl","msl"); end isvis = logical(isvis);
note that los2
calculates line-of-sight visibility assuming the data is referenced to a spherical earth, whereas the data is actually referenced to the wgs84 ellipsoid, and as a result there may be minor discrepancies. the line-of-sight calculation also corresponds to optical line-of-sight and does not account for refraction through the atmosphere.
visualize line-of-sight visibility over terrain
plot the line-of-sight visibility. use green markers where the aircraft is visible from the airport and magenta markers where it is not visible.
delete(traj) geoplot3(g,tlat(isvis),tlon(isvis),tht(isvis),"og", ... "heightreference","ellipsoid", ... "linewidth",2, ... "markersize",1) geoplot3(g,tlat(~isvis),tlon(~isvis),tht(~isvis),"om", ... "heightreference","ellipsoid", ... "linewidth",2, ... "markersize",1)
view the line-of-sight plot from the perspective of the airport. get the geodetic coordinates of the position that is 900 meters east, 200 meters north, and 100 meters up from the radar location. then, set the camera position and rotation angles. the green markers appear in view, but the magenta markers are either completely or partially obstructed by terrain.
rdrht = rdralt egm96geoid(rdrlat,rdrlon); [camlat,camlon,camht] = enu2geodetic(900,200,100,rdrlat,rdrlon,rdrht,wgs84); campos(g,camlat,camlon,camht) camheading(g,-110) campitch(g,0)
visualize aircraft line-of-sight visibility contours on a 2-d map
the previous sections performed point-to-point line-of-sight analysis and visualization from a radar location to an aircraft trajectory. now perform point-to-area line-of-sight analysis and visualization from the same radar location over the terrain region. the visualization displays the edge of visibility for an aircraft flying at constant altitude.
plot radar location and terrain limits on a 2-d map
plot the radar location in a new figure with a topographic 2-d map.
figure geoplot(rdrlat,rdrlon,"co", ... "linewidth",6, ... "markersize",3, ... "displayname","radar location") geobasemap topographic gx = gca; gx.innerposition = gx.outerposition;
display the limits of the custom terrain as a rectangle on the map.
latmin = latlim(1); latmax = latlim(2); lonmin = lonlim(1); lonmax = lonlim(2); hold on geoplot([latmin latmin latmax latmax latmin],[lonmin lonmax lonmax lonmin lonmin], ... "linewidth",1, ... "color","k", ... "displayname","terrain limits")
display a legend in the northwest corner.
legend("location","northwest")
plot visibility contours for aircraft flying at constant altitude
specify three altitudes above mean sea level for the aircraft. for each altitude:
compute the viewshed using the radar location as the observer. the viewshed defines the area that has line-of-sight visibility.
find the edge of aircraft visibility by computing contours from the viewshed data.
remove small contour segments.
plot the contours on the geographic axes.
tgtalts = [3000 4000 5000]; minvertices = 10; cfig = figure("visible","off"); % suppress contour plot using invisible figure cax = axes("parent",cfig); for tgtalt = tgtalts vis = viewshed(zterrain,rterrain,rdrlat,rdrlon,rdralt,tgtalt,"msl","msl"); c = contourm(vis,rterrain,"levellist",1,"parent",cax); clat = c(2,:); clon = c(1,:); clats = []; clons = []; k = 1; while k < size(c,2) numvertices = clat(k); if numvertices > minvertices % do not plot small segments clats = [clats clat(k 1:k numvertices) nan]; %#okclons = [clons clon(k 1:k numvertices) nan]; %#ok end k = k numvertices 1; end geoplot(gx,clats,clons,"linewidth",2, ... "displayname", "aircraft: " string(tgtalt) " m"); end
the contours appear primarily to the west of the radar location over the mountains. the contours do not appear in other directions because visibility is not constrained by the terrain in those directions within the terrain data limits.
if the radar is constrained by line-of-sight visibility, then the contours correspond to radar coverage regions for varying altitude, where the nearest contour to the radar corresponds to radar coverage for an aircraft flying at 3000 meters and the furthest contour corresponds to radar coverage for an aircraft flying at 5000 meters.
as with los2
, the viewshed
function calculates line-of-sight visibility assuming the data is referenced to a spherical earth, whereas the data is actually referenced to the wgs84 ellipsoid, and as a result there may be minor discrepancies. the line-of-sight calculation also corresponds to optical line-of-sight and does not account for refraction through the atmosphere.
clean up
clean up by closing the geographic globe and removing the imported terrain data.
if isvalid(fig) close(fig) end removecustomterrain("southboulder")
see also
functions
- | | | | |