Mapping Toolbox | ![]() ![]() |
Line of sight visibility between two points in terrain
Syntax
los2 vis = los2(map,maplegend,lat1,lon1,lat2,lon2) vis = los2(map,maplegend,lat1,lon1,lat2,lon2,alt1) vis = los2(map,maplegend,lat1,lon1,lat2,lon2,alt1,alt2) vis = los2(map,maplegend,lat1,lon1,lat2,lon2,alt1,alt2,alt1opt) vis = los2(map,maplegend,lat1,lon1,lat2,lon2,alt1,alt2,alt1opt,alt2op t) vis = los2(map,maplegend,lat1,lon1,lat2,lon2,alt1,alt2,alt1opt,alt2op t,actualradius) vis = los2(map,maplegend,lat1,lon1,lat2,lon2,alt1,alt2,alt1opt,alt2op t,actualradius,effectiveradius) [vis,visprofile,dist,z,lattrk,lontrk] = los2(...) los2(...)
Description
los2 computes the mutual visibility between two points on a displayed digital elevation map. los2
uses the current object if it is a regular matrix map, or the first regular matrix map found on the current axes. The map's zdata is used for the profile. The color data is used in the absence of data in z. The two points are selected by clicking on the map. The result is displayed in a new figure. Markers indicate visible and obscured points along the profile. The profile is shown in a cartesian coordinate system with the origin at the observer's location. The displayed z coordinate accounts for the elevation of the terrain and the curvature of the body.
vis = los2(map,maplegend,lat1,lon1,lat2,lon2) computes the mutual visibility between pairs of points on a digital elevation map. The elevations are provided as a regular matrix map containing elevations in units of meters. The two points are provided as vectors of latitudes and longitudes in units of degrees. The resulting logical variable vis is equal to one when the two points are visible to each other, and zero when the line of sight is obscured by terrain. If any of the input arguments are empty, los2
attempts to gather the data from the current axes. With one or more output arguments, no figures are created and only the data is returned.
vis = los2(map,maplegend,lat1,lon1,lat2,lon2,alt1) places the first point at the specified altitude in meters above the surface. This is equivalent to putting the point on a tower. If omitted, the point is assumed to be on the surface.
vis = los2(map,maplegend,lat1,lon1,lat2,lon2,alt1,alt2) also places the second point at a specified altitude in meters above the surface. If omitted, the point is assumed to be on the surface.
vis = los2(map,maplegend,lat1,lon1,lat2,lon2,alt1,alt2,alt1opt) controls whether the first point is at a relative or absolute altitude. If the altitude option is 'AGL', the point's altitude is in meters above the terrain ground level. If alt1opt is 'MSL', alt1 is interpreted as altitude above zero, or mean sea level. If omitted, 'AGL' is assumed.
vis = los2(map,maplegend,lat1,lon1,lat2,lon2,alt1,alt2,alt1opt,alt2opt) also controls the interpretation of the second point's altitude.
vis = los2(map,maplegend,lat1,lon1,lat2,lon2,alt1,alt2,alt1opt,alt2opt,actualradius) does the visibility calculation on a sphere with the specified radius. If omitted, the radius of the earth in meters is assumed. The altitudes, elevations and the radius should be in the same units. This calling form is most useful for computations on bodies other than the Earth.
vis = los2(map,maplegend,lat1,lon1,lat2,lon2,alt1,alt2,alt1opt,alt2opt,actualradius,effectiveradius) assumes a larger radius for propagation of the line of sight. This can account for the curvature of the signal path due to refraction in the atmosphere. For example, radio propagation in the atmosphere is commonly treated as straight line propagation on a sphere with 4/3rds the radius of the earth. In that case the last two arguments would be R_e and 4/3*R_e, where R_e is the radius of the Earth. Use Inf as the effective radius for flat Earth visibility calculations. The altitudes, elevations and the radii should be in the same units.
[vis,visprofile,dist,z,lattrk,lontrk] = los2(...) also returns vectors of points along the path between the two points. The visprofile is a vector containing ones where the intermediate points are visible. Dist is the distance along the path (in meters or the units of the radius). Z contains the terrain profile relative to the z datum along the path. Lattrk and lontrk are the latitudes longitudes of the the points along the path.
los2(...), with no output arguments, displays the visibility profile between the two points in a new figure.
Example
Check the visibility between two points on the peaks map.
map = 500*peaks(100); maplegend = [ 1000 0 0]; [lat1,lon1,lat2,lon2]=deal(-0.027,0.05,-0.093,0.042); los2(map,maplegend,lat1,lon1,lat2,lon2,100) ans = 1![]()
Display the same data together with the peaks surface.
figure axesm('globe','geoid',almanac('earth','sphere','meters')) meshm(map,maplegend,size(map),map); axis tight camposm(-10,-10,1e6); camupm(0,0) demcmap('inc',map,1000); shading interp; camlight [vis,visprofile,dist,z,lattrk,lontrk] = los2(map,maplegend,lat1,lon1,lat2,lon2,100); plot3m(lattrk([1;end]),lontrk([1; end]),z([1; end])+[100; 0],'r','linewidth',2) plotm(lattrk(~visprofile),lontrk(~visprofile),z(~visprofile),'r .','markersize',10) plotm(lattrk(visprofile),lontrk(visprofile),z(visprofile),'g.', 'markersize',10)![]()
See Also
viewshed |
Compute visible areas from a point on a digital elevation map |
mapprofile |
Interpolate values between waypoints on a regular matrix map |
![]() | linem | ltln2val | ![]() |