当前位置: 首页 > news >正文

商场网站开发教程网站开发项目工作分解

商场网站开发教程,网站开发项目工作分解,服务专业的网站建设公司,同一个地方做几个网站在地理绘图中,我们使用的DEM数据添加山体阴影使得绘制的图件显得更加的美观。 GIS中使用ArcGIS软件就可以达到这一目的,或者使用GMT,同样可以得到山体阴影的效果。 本文提供了一个MATLAB的函数,可以得到山体阴影。 clear all;c…

在地理绘图中,我们使用的DEM数据添加山体阴影使得绘制的图件显得更加的美观。

GIS中使用ArcGIS软件就可以达到这一目的,或者使用GMT,同样可以得到山体阴影的效果。

本文提供了一个MATLAB的函数,可以得到山体阴影。

clear all;clc;close all
load demo.mat
%% draw hillshade
x=x(:,1);
y=y(1,:);
hs=hillshade_esri(z,x,y);
subplot(1,2,1)
imagesc(x,y,z')
axis image
set(gca,'ydir','normal')
title('DEM')
colormap(gray)
caxis([min(z(:)) max(z(:))])
subplot(1,2,2)
imagesc(x,y,hs')
axis image
set(gca,'ydir','normal')
title('Hillshade')
colormap(gray)
hold on
caxis([min(hs(:)) max(hs(:))])
drawnow

其中调用的函数 hillshade_esri.m如下:

function h = hillshade_esri(dem,X,Y,varargin)
% PUPROSE: Calculate hillshade for a digital elevation model (DEM) based on
%          the algorithm posted on http://edndoc.esri.com/arcobjects/9.2/net/shared/geoprocessing/spatial_analyst_tools/how_hillshade_works.htm
% -------------------------------------------------------------------
% USAGE: h = hillshade_esri(dem,X,Y,varagin)
% where: dem is the DEM to calculate hillshade for
%        X and Y are the DEM coordinate vectors
%        varargin are parameters options
%
% OPTIONS: 
%        'azimuth'  is the direction of lighting in deg (default 315)
%        'altitude' is the altitude of the lighting source in
%                   in degrees above horizontal (default 45)
%        'zfactor'  is the DEM altitude scaling z-factor (default 1)
%        'plotit'   creates a simple plot of the hillshade
%
% EXAMPLE:
%       h=hillshade_esri(peaks(50),1:50,1:50,'azimuth',45,'altitude',100,'plotit')
%       - calculates the hillshade for an example 50x50 peak surface.
%       - changes the default settings for azimuth and altitude.
%       - creates an output hillshade plot% See also: GRADIENT, CART2POL
%
% Note: Uses ESRIs hillshade algorithm, the output will be the same as the
% output with ArcGIS Hillshade Function.
%
% Felix Hebeler, Dept. of Geography, University Zurich, February 2007.
% modified by Andrew Stevens (astevens@usgs.gov), 5/04/2007
% modified by Wenbin Jiang (jwbalbert@gmail.com), 7/06/2011%% configure inputs
%default parameters
azimuth=315;
altitude=45;
zf=1;
plotit=0;%parse inputs
if isempty(varargin)~=1     % check if any arguments are given[m1,n1]=size(varargin);opts={'azimuth';'altitude';'zfactor';'plotit'};for i=1:n1;             % check which parameters are givenindi=strcmpi(varargin{i},opts);ind=find(indi==1);if isempty(ind)~=1switch indcase 1azimuth=varargin{i+1};case 2altitude=varargin{i+1};case 3zf=varargin{i+1};case 4plotit=1;endendend
end%% Initialize paramaters
dx=abs(X(2)-X(1));  % get cell spacing in x and y direction
dy=abs(Y(2)-Y(1));  % from coordinate vectors% lighting azimuth
azimuth = 360.0-azimuth+90; %convert to mathematic unit 
azimuth(azimuth>=360)=azimuth-360;
azimuth = azimuth * (pi/180); %  convert to radians%lighting altitude
altitude = (90-altitude) * (pi/180); % convert to zenith angle in radians%% calc slope and aspect (radians)
im=length(X);
jm=length(Y);
fx=zeros(im,jm);
fy=zeros(im,jm);
asp=zeros(im,jm);
for i=2:im-1for j=2:jm-1fx(i,j)=((dem(i+1,j+1)+2*dem(i+1,j)+dem(i+1,j-1))-(dem(i-1,j+1)+2*dem(i-1,j)+dem(i-1,j-1)))/8/dx;fy(i,j)=((dem(i-1,j-1)+2*dem(i,j-1)+dem(i+1,j-1))-(dem(i-1,j+1)+2*dem(i,j+1)+dem(i+1,j+1)))/8/dy;if fx(i,j)~=0asp(i,j) = atan2(fy(i,j),-fx(i,j));if asp(i,j)<0asp(i,j)=asp(i,j)+2*pi;endelseif fy(i,j)>0asp(i,j)=pi/2;elseif fy(i,j)<0asp(i,j)=3*pi/2;endend     end
end
grad = hypot(fx,fy);
grad=atan(zf*grad); %steepest slope%% hillshade calculation
h = 255.0*( (cos(altitude).*cos(grad) ) + ( sin(altitude).*sin(grad).*cos(azimuth-asp)) ); % ESRIs algorithm
h(h<0)=0; % set hillshade values to min of 0.
h=setborder(h,1,NaN); % set border cells to NaN%% plot results if requested
if plotit==1figureimagesc(X,Y,h')axis imageset(gca,'ydir','normal')colormap(gray)
end%% -- Subfunction--------------------------------------------------------------------------
function grid = setborder(grid,bs,bvalue)
grid(1:bs,:)=bvalue; %toprows
grid(size(grid,1)-bs+1:size(grid,1),:)=bvalue; %bottom rows
grid(:,1:bs)=bvalue; %left cols
grid(:,size(grid,2)-bs+1:size(grid,2))=bvalue;

其中有三个参数可以修改:azimuth=315;altitude=45;zf=1;

1.修改 azimuth,the direction of lighting in deg,下图的变化范围为0:360:

2.修改 altitude,the altitude of the lighting source in degrees above horizontal,下图变化范围为0:180:

 

3.修改 zf,the DEM altitude scaling z-factor ,下图变化范围为1:50:

http://www.yayakq.cn/news/518108/

相关文章:

  • 服务网站备案wordpress移动端显示图片
  • 北京建站公司推荐首推万维科技wap网站开发用什么语言
  • 柳州网站建设psn118东莞vi设计公司排名
  • 网站商品图片怎么做免费书画网站模板
  • seo关键词挖掘工具网站内页怎样做优化
  • 用什么软件做网站模板灌南县建设局网站
  • 建众智业公司简介优化营商环境 提升服务效能
  • 假的建设银行网站asp 课程教学网站开发
  • 网站建设的优势wordpress开发手册下载
  • 国外网站建设什么价格云南省建设厅官方网站证书
  • 烟台建网站哪家好郑州软件公司排行榜
  • 网络营销策划方案1500字机械类产品网站做优化
  • 网站的排版阿里巴巴国际站外贸流程
  • 网站建设的方法有哪些内容有没有做校园文化的网站
  • 淘宝网站建设类目需要什么资质上海公司黄页
  • 珠海网站建设招聘买房咨询平台在线
  • 万网网站建设购买过程网站建设如何收费
  • 毕业设计做旅游网站替别人做网站
  • 大连网站外包重庆网站建设去迅法网
  • 网站建设与管理大作业网站悬浮窗口代码
  • 网站伪静态如何配置龙岗网站制作设计
  • 河北响应式网站建设哪家有百度上传网站服务器
  • 后台管理网站模板下载精通网站建设
  • 织梦做网站视频教程叫别人做网站要多久
  • 游戏代理怎么找渠道哈尔滨网络优化公司
  • 郑州做网站加密的公司518机械加工网
  • 北京网站建设降龙粉末涂料做网站有用吗
  • 直播视频东莞seo网络营销
  • 网站建设合作协议宣传片拍摄制作公司
  • 免费ppt模板大全下载的网站服务器网站开发过程