提供一个可以对边界文件进行缓冲区的matlab代码

在地理信息系统中(GIS)中,我们一般使用ArcGIS对点、线、面要素进行缓冲区分析。这里我提供一个可以对封闭曲线进行缓冲区操作的matlab代码,具体的函数内容如下:

clear;clc;

%% Load original boundary data
border = load('Tibet_boundary.txt'); 
% sta_info=importdata('sites.info');

%% Generate a buffer with any radiuses for study area
d=2.5; % 2.5 degree buffer
polyout = polybuffer([border(:,1) border(:,2)],'lines',d);
out = inpolygon(polyout.Vertices(:,1),polyout.Vertices(:,2),border(:,1),border(:,2));
edge_points=[polyout.Vertices(~out,1) polyout.Vertices(~out,2)];

d=0.25; % 0.25 degree buffer
polyout = polybuffer([border(:,1) border(:,2)],'lines',d);
out = inpolygon(polyout.Vertices(:,1),polyout.Vertices(:,2),border(:,1),border(:,2));
edge_points1=[polyout.Vertices(~out,1) polyout.Vertices(~out,2)];

%% Plot original and extended boundary
figure('color',[1 1 1])
plot(border(:,1),border(:,2));
hold on
plot(edge_points(:,1),edge_points(:,2));
hold on
plot(edge_points1(:,1),edge_points1(:,2));

得到了青藏高原边界2.5°和0.25°的缓冲区

提供一个可以对边界文件进行缓冲区的matlab代码_第1张图片

 

你可能感兴趣的:(matlab,开发语言,经验分享,学习)