Tracking Agent Space Occupancy on Grid

30 views
Skip to first unread message

Quentin Devalloir

unread,
May 2, 2025, 6:54:05 AMMay 2
to GAMA

Dear all,

I'm currently working on an individual-based model (IBM) in GAMA where I aim to compare how agents occupy space over time using a grid. My goal is to create a grid where each cell starts at zero and increments by +1 every time an agent passes through or occupies that cell.

So far, I’ve tried two different approaches without success:

  1. The example from the GAMA wiki on Movement on a Grid of Cells, but since my agents use a wander behavior, the return_path function isn’t compatible or doesn't work as expected in this case.

  2. The generate_pedestrian_paths example, to get a .shp of space occupancy but  it doesn’t seem to suit my need for tracking free-form trajectories of wandering agents.

Do you have any suggestions, or know of other examples or strategies that could help me implement this type of space occupancy tracking?

Thanks in advance for your help!

Best regards,
Quentin

Benoit Gaudou

unread,
May 4, 2025, 12:09:28 PMMay 4
to gama-p...@googlegroups.com
Dear,
You can simply make your agents move and update an attribute of the cell overlapping (cf. this GAML operator) it.
If you want your agent can jump from one cell to another one (that are not neighbors), and want to update all the cell on the path, 
you can simply create a line geometry (line operator) (from the previous location to the new one), and update all the cells overlapping that line.

Best regards
Benoit

--
You received this message because you are subscribed to the Google Groups "GAMA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gama-platfor...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/gama-platform/61fd2269-8a00-4b8c-8538-2a5565dbe394n%40googlegroups.com.

Quentin Devalloir

unread,
May 21, 2025, 11:55:02 AMMay 21
to gama-p...@googlegroups.com
Dear Benoit, 

Thank you very much for your answer, I managed to add a "path" attribute of my agent with : 
my_grid Ag_path <- one_of(my_species overlapping(self.location));
However, I fail to get a shapefile containing my agent path attribute with 'save' . Here is what I did:
save my_grid to: "my_grid_move05.csv" format: "csv" ;
and
save my_grid to: "my_grid_move05.csv" format: "csv" attributes:: [name, Ag_path];
Do you know how can I fix the attribute in the .dbf file please ? 

Many thanks in advance

Best regards

Quentin 


You received this message because you are subscribed to a topic in the Google Groups "GAMA" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gama-platform/WOPs_UtlAso/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gama-platfor...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/gama-platform/CAD4GtYFn7GP9KeCT4FDay2948ekt4cpTwRgQkN%2BARMu2fzMQ3w%40mail.gmail.com.

Benoit Gaudou

unread,
May 27, 2025, 2:25:30 AMMay 27
to gama-p...@googlegroups.com
Dear,
Here you are saving your agents as a CSV file, which does not contain the geometry.
You should save it as a shapefile (see the dedicated model in the model library).
Benoit

Quentin Devalloir

unread,
Jun 11, 2025, 1:39:45 PMJun 11
to GAMA
Hello, 
Indeed...  It works better with : 
save my_grid to: "my_grid.shp" format: "shp"
Sorry for this nooby mistake.
Now it's fixed, thanks a lot ! 
Have a good day

Reply all
Reply to author
Forward
0 new messages