3. Import GIS data
This step loads the road and building shapefiles as agents and places people inside buildings. The world geometry is set from the road layer's spatial envelope.

The model library includes the shapefiles in the model's includes directory. The GAML paths below are relative to the model file.
Load the data and create agents​
The from facet creates one agent from each feature in a shapefile. any_location_in chooses a location within a selected building.
global {
int nb_people <- 2147;
int nb_infected_init <- 5;
float step <- 5 #mn;
file roads_shapefile <- file("../includes/roads.shp");
file buildings_shapefile <- file("../includes/buildings.shp");
geometry shape <- envelope(roads_shapefile);
int nb_people_infected <- nb_infected_init update: people count (each.is_infected);
int nb_people_not_infected <- nb_people - nb_infected_init update: nb_people - nb_people_infected;
float infected_rate update: nb_people_infected / nb_people;
init {
create road from: roads_shapefile;
create building from: buildings_shapefile;
create people number: nb_people {
location <- any_location_in(one_of(building));
}
ask nb_infected_init among people {
is_infected <- true;
}
}
reflex end_simulation when: infected_rate = 1.0 {
experiment.pause();
}
}
Display roads and buildings​
Each GIS agent's default shape is drawn using its geometry. The map order places people above roads and buildings.
species road {
aspect geom {
draw shape color: #black;
}
}
species building {
aspect geom {
draw shape color: #gray;
}
}
display map map_order: true {
species road aspect: geom;
species building aspect: geom;
species people aspect: circle;
}
See the complete Luneray Flu model 3 in the model library.