Urban Planning Based on Cellular Automata

                      Cellular Automata-Urban Planning

1. Urban Scale Design
Xiongan New Area covers an area of about 2,000 square kilometers. It covers Xiongxian, Rongcheng and Anxin counties in Hebei Province and some surrounding areas. It is located in the hinterland of Beijing, Tianjin and Baoding. The area is searched and extracted by ArcGIS map software. The regional map is shown below.

In order to simulate Xiongan New Area better, firstly, the map of Xiongan New Area is intercepted from the map, then the edge contour is extracted and the undeveloped areas such as Baiyangdian are eliminated to obtain the preprocessed image. Finally, image graying and binarization are processed with MATlAB as shown in the following figure. It provides evolutionary maps for subsequent cellular automata.

General steps of urban planning model:
Firstly, the main elements of its composition are determined: cell, cell space, cell state, cell neighborhood and transformation rules.
Analysis and Simulation of urban spatial structure;
Determining the parameters of the model: reproductive parameters, diffusion parameters, propagation parameters and constrained parameters by planning
Definition of Cellular Transformation Rules for Model
The simulation of urban development is carried out.

2. Urban Scale Simulation
Initial stage:

Mid-term stage

Forward stage

program1:   Be based on MATLAB2014a programming
clear;close all
I=imread('city.png');
level=graythresh(I);   % Image gray processing
bw=im2bw(I,level);  % Image Binary Processing
I=bw;
cells=double(I);
%Definition button
plotbutton=uicontrol('style','pushbutton',...
'string','Run',...
'fontsize',12,...
'position',[100,400,50,20],...
'callback','run=1;');
erasebutton=uicontrol('style','pushbutton',...
'string','Stop',...
'fontsize',12,...
'position',[300,400,50,20],...
'callback','freeze=1;');
number=uicontrol('style','text',...
'string','1',...
'fontsize',12,...
'position',[20,400,50,20]);
%Initialization
cells(33,44)=2;
cells(88,31)=2;
cells(33,80)=2;
%Parameter definition
kuosan=0.2;fanzhi=0.2;chuanbo=0.2;chengshihua=0.0004;sch=[];skz=[];t=1;
[x,y]=size(cells);
run=0;
freeze=0;
stop=0;
while (stop==0)
    if(run==1)
for i=1:x
    for j=1:y
        if(cells(i,j)~=1)
        if(cells(i,j)==0) %Natural growth
            if(rand<chengshihua)
                cells(i,j)=2;
            end
            if(aroundcenter(i,j,cells))
                if(rand<chuanbo)
                    cells(i,j)=2;
                end
            end
         end
        if(cells(i,j)==2 && rand<kuosan)  %Boundary growth
               if(exist1(i,j,cells))   
                   m=1+3*rand;
                   switch  m
                       case 1
                          ii=i-1;jj=j;
                       case 2
                          ii=i;jj=j-1;
                       case 3
                          ii=i;jj=j+1;
                       otherwise 4
                           ii=i+1;jj=j;
                   end
               if(cancity(ii,jj,cells))  
                   cells(ii,jj)=2;
               end
               end
        end
       if(cells(i,j)==2 && exist1(i,j,cells)) %New Extended Center Type
           if(rand<fanzhi)
               if(cancity(i,j,cells))
                   cells(i,j)=3;
               end
           end
       end
        end
    end
end
ch=0;kzch=0;
for i=1:x
    for j=1:y
        if(cells(i,j)==2) ch=ch+1;end
        if(cells(i,j)==3) kzch=kzch+1;end
    end
end
sch(t)=ch;skz(t)=kzch;
t=t+1;
[A,B]=size(cells);
Area(1:A,1:B,1)=zeros(A,B);
Area(1:A,1:B,2)=zeros(A,B);
Area(1:A,1:B,3)=zeros(A,B);
for i=1:A
for j=1:B
if cells(i,j)==1
Area(i,j,:)=[1,1,1];
elseif cells(i,j)==0
Area(i,j,:)=[255,255,255];
elseif cells(i,j)==3
Area(i,j,:)=[255,0,0];
elseif cells(i,j)==2
Area(i,j,:)=[255,177,0];
end
end
end
pause(0.0005);
Area=uint8(Area);
Area=imagesc(Area);
axis equal;
axis tight;
%Pace taking
stepnumber=1+str2num(get(number,'string'));
set(number,'string',num2str(stepnumber));
    end
if freeze==1
run=0;
freeze=0;
end
drawnow
end
function a=aroundcenter(i,j,cells)
a=0;
if(cells(i-1,j)==3)  a=1; end
if(cells(i,j-1)==3)  a=1;end
if(cells(i,j+1)==3)  a=1;end
if(cells(i+1,j)==3)  a=1;end
end
function result= exist1(i,j,cells)
a=0;
if(cells(i-1,j)==2)  a=a+1; end
if(cells(i,j-1)==2)  a=a+1;end
if(cells(i,j+1)==2)  a=a+1;end
if(cells(i+1,j)==2)  a=a+1;end
if(a>=2)
    result=1;
else
    result=0;
end
end
function result=cancity(i,j,cells)
s=0
if(cells(i-1,j-1)==1)   s=s+1;end
if(cells(i-1,j)==1)   s=s+1;end
if(cells(i-1,j+1)==1)   s=s+1;end
if(cells(i,j-1)==1)   s=s+1;end
if(cells(i,j+1)==1)   s=s+1;end
if(cells(i+1,j-1)==1)   s=s+1;end
if(cells(i+1,j)==1)   s=s+1;end
if(cells(i+1,j+1)==1)   s=s+1;end
function result=cancity(i,j,cells)
s=0
if(cells(i-1,j-1)==1)   s=s+1;end
if(cells(i-1,j)==1)   s=s+1;end
if(cells(i-1,j+1)==1)   s=s+1;end
if(cells(i,j-1)==1)   s=s+1;end
if(cells(i,j+1)==1)   s=s+1;end
if(cells(i+1,j-1)==1)   s=s+1;end
if(cells(i+1,j)==1)   s=s+1;end
if(cells(i+1,j+1)==1)   s=s+1;end
if(s>=4)
    result=0;
else 
    result=1;
end
end

Keywords: MATLAB Programming

Added by madhavr on Tue, 04 Jun 2019 00:22:04 +0300