Step3: 整合GIS数据
载入GIS数据并初始化
global {
//载入GIS数据
file roads_shapefile <- file("../includes/road.shp");
file buildings_shapefile <- file("../includes/building.shp");
//将全局代理形状设置为包括所有道路的矩形
geometry shape <- envelope(roads_shapefile);
...
init{
//从GIS数据创建建筑和道路
create road from: roads_shapefile;
create building from: buildings_shapefile;
//代理人的初始位置设置为随机建筑的任意位置
create people number:nb_people {
speed <- agent_speed;
location <- any_location_in(one_of(building));
}
}
}编写人群的移动行为

Last updated