Mapping Toolbox | ![]() ![]() |
Compute areas visible from a point on a digital elevation map.
Syntax
[vismap,vismaplegend] = viewshed(map,maplegend,lat1,lon1) [..] = viewshed(map,maplegend,lat1,lon1,oalt) [..] = viewshed(map,maplegend,lat1,lon1,oalt,talt) [..] = viewshed(map,maplegend,lat1,lon1,oalt,talt,oaltopt) [..] = viewshed(map,maplegend,lat1,lon1,oalt,talt,oaltopt,taltopt) [..] = viewshed(map,maplegend,lat1,lon1,oalt,talt,oaltopt,taltopt,actu alradius) [..] = viewshed(map,maplegend,lat1,lon1,oalt,talt,oaltopt,taltopt,actu alradius,effectiveradius)
Description
[vismap,vismaplegend] = viewshed(map,maplegend,lat1,lon1) computes areas visible from a point on a digital elevation map. The elevations are provided as a regular matrix map containing elevations in units of meters. The observer location is provided as scalar latitude and longitude in units of degrees. The resulting vismap contains ones at the surface locations visible from the observer location, and zeros where the line of sight is obscured by terrain.
viewshed(map,maplegend,lat1,lon1,oalt)
places the observer at the specified altitude in meters above the surface. This is equivalent to putting the observer on a tower. If omitted, the observer is assumed to be on the surface.
viewshed(map,maplegend,lat1,lon1,oalt,talt) checks for visibility of target points a specified distance above the terrain. This is equivalent to putting the target points on towers which do not obstruct the view. if omitted, the target points are assumed to be on the surface.
viewshed(map,maplegend,lat1,lon1,oalt,talt,oaltopt) controls whether the observer is at a relative or absolute altitude. If the observer altitude option is 'AGL', the observer altitude oalt is in meters above ground level. If oaltopt is 'MSL', oalt is interpreted as altitude above zero, or mean sea level. If omitted, 'AGL' is assumed.
viewshed(map,maplegend,lat1,lon1,oalt,talt,oaltopt,taltopt) controls whether the target points are at a relative or absolute altitude. If the target altitude option is 'AGL', the target altitude talt is in meters above ground level. If taltopt is 'MSL', talt is interpreted as altitude above zero, or mean sea level. If omitted, 'AGL' is assumed.
viewshed(map,maplegend,lat1,lon1,oalt,talt,oaltopt,taltopt,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.
viewshed(map,maplegend,lat1,lon1,oalt,talt,oaltopt,taltopt,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 and 4/3*R_e, where R is the radius of the earth. Use Inf for flat Earth viewshed calculations. The altitudes, elevations and the radii should be in the same units.
Example
Compute visibility for point on the peaks map. Add the detailed information for the line of sight calculation between two point from los2
.
map = 500*peaks(100); maplegend = [ 1000 0 0]; [lat1,lon1,lat2,lon2]=deal(-0.027,0.05,-0.093,0.042); [vismap,vismapleg] = viewshed(map,maplegend,lat1,lon1,100); [vis,visprofile,dist,z,lattrk,lontrk] = los2(map,maplegend,lat1,lon1,lat2,lon2,100); axesm('globe','geoid',almanac('earth','sphere','meters')) meshm(vismap,vismapleg,size(map),map); axis tight camposm(-10,-10,1e6); camupm(0,0) colormap(flipud(summer(2))); brighten(0.75); shading interp; camlight h = lcolorbar({'obscured','visible'}); set(h,'Position',[.875 .45 .02 .1]) 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)![]()
Compute the surface areas visible by radar from an aircraft 3000 meters above the Yellow Sea. Assume that radio wave propagation in the atmosphere can be modeled as straight lines on a 4/3rds radius Earth. Display the visible areas as blue and the obscured areas as red. Drape the visibility colors on an elevation map, and use lighting to bring out the surface topography. The aircraft's radar can see out a certain radius on the surface of the ocean, but some ocean areas are shadowed by the island of Jeju-Do. Also some mountain valleys closer than the ocean horizon are obscured, while some mountain tops further away are visible.
load korea map(map<0) = -1; figure worldmap(map,maplegend,'ldem3d') lat = 34.0931; lon = 125.6578; altobs = 3000; alttarg = 0; plotm(lat,lon,'wo') Re = almanac('earth','radius','m'); [vmap,vmapl] = viewshed(map,maplegend,lat,lon,altobs,alttarg,'MSL','AGL',Re,4/ 3*Re); clmo surface meshm(vmap,vmapl,size(map),map) caxis auto; colormap([1 0 0; 0 0 1]) lighting phong; material metal hidem(gca)
![]()
Over what area can the radar plane flying at an altitude of 3000 meters have line-of-sight to other aircraft flying at 5000 meters? Now the area is much larger. Some edges of the area are reduced by shadowing from Jeju-Do and the mountains on the Korean peninsula.
[vmap,vmapl] = viewshed(map,maplegend,lat,lon,3000,5000,'MSL','MSL',Re,4/ 3*Re); clmo surface meshm(vmap,vmapl,size(map),map) material metal lighting phong![]()
See Also
los2 |
Line of sight visibility between two points in terrain |
![]() | vfwdtran | vinvtran | ![]() |