Using Open Street Maps (.OSM files) instead of shapefiles directly in Gama

213 views
Skip to first unread message

Ariadni Michalitsi

unread,
Feb 4, 2021, 3:11:56 AM2/4/21
to gama-p...@googlegroups.com

Dear all,

I have recently started working on Gama to run simulation experiments for my PhD thesis. The documentation you provide is really helpful. Let me also say that your work with COMOKIT is really inspiring.

I run some issues, though, with the loading of GIS data in my simulation. I have decided to work with .OSM data, although I see more options in your documentation for shapefiles. Are OSM data not that appropriate for some reason in GAMA?

Since I am from Greece, I am trying to run my simulations there, and I have encountered some problems, particularly buildings missing from the simulation. Taking, for example, my university, National Technical University of Athens, and trying to simulate the campus, buildings are missing, although taken into account in the filtering. For example the building "Electrical and Comp. Eng. School" although it is a "university" building and I have considered it in the filtering (as you can see below) is not displayed. On the contrary, the building beside, “Mining Engineering and Metallurgy school” is well displayed. I also attach a screenshot of my simulation and the referred .osm data file.

The filtering I have used is:

map filtering <- (["highway"::["primary", "secondary", "tertiary", "motorway", "living_street","residential", "unclassified", "service", "secondary_link", "pedestrian", "footway", "steps"],

"building"::["yes", "dormitory", "university", "church", "office", "residential", "commercial", "house", "hotel", "apartments", "industrial", "retail", "hospital", "government"]]);

 

And the code after that:

//OSM file to load

file<geometry> osmfile <-  file<geometry>(osm_file("../includes/emp1.osm", filtering))  ;

 

 

//compute the size of the environment from the envelope of the OSM file

geometry shape <- envelope(osmfile);

create osm_agent from:osmfile with: [highway_str::string(read("highway")), building_str::string(read("building"))];

 

//from the created generic agents, creation of the selected agents

ask osm_agent {

if (length(shape.points) = 1 and highway_str != nil ) {

create node_agent with: [shape ::shape, type:: highway_str];

} else {

if (highway_str != nil ) {

create road with: [shape ::shape, type:: highway_str];

} else if (building_str != nil){

create building with: [shape ::shape];

}

//do the generic agent die

do die;

}

 

I would be more than grateful if you could help me understand what I am doing wrong.

 

Kind Regards,

Ariadni

simulation_screenshot.PNG
emp1.osm

Benoit Gaudou

unread,
Feb 8, 2021, 4:24:01 AM2/8/21
to gama-p...@googlegroups.com
Dear,

GAMA management of geographical data has been designed in a way closer to shapefile spirit than to OSM one.
In particular, GAMA manipulates species of agents with attributes, which can be directly translated into a shapefile.
So GAMA has more tools related to shapefile (in particular to export agents).

So commonly,  when input data are OSM, a small model is developed to import the relevant entities from the OSM and to export them into shapefiles (after cleaning if needed, for example for road network).
then shapefiles will be used as input file of the model.

I had a  look at the data of the area, and indeed it seems that we have an issue in GAMA reading the osm file.
(I get a very small osm file with the 2 buildings you mention).
I  open it in  QGIS and can observe  the 2  buildings, but not in GAMA (and in its OSM Viewer).

We will  have  a  look at that point.

cheers

Benoit Gaudou


--
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 on the web visit https://groups.google.com/d/msgid/gama-platform/CAD3_mVdVdwQHDBXT0VWGZnr8TGjB-uo8wXwS9QcS%2B4x8G-QLbA%40mail.gmail.com.
mapGreceSmall.osm

Patrick Taillandier

unread,
Feb 8, 2021, 10:09:16 PM2/8/21
to gama-p...@googlegroups.com
Hi,

Sorry for my late reply.
You are right, there is an issue here (I am going to fix it as soon as possible): the university (and maybe some other buildings) has a value for the "amenity" attribute that is not nil, so GAMA, instead of considering it both as an amenity and as a building seems to consider it just as an amenity.
A workaround is just to add the building amenity to the filtering map:

 map filtering <- (["highway"::["primary", "secondary", "tertiary", "motorway", "living_street","residential", "unclassified", "service", "secondary_link", "pedestrian", "footway", "steps"],"amenity"::["university"], "building"::["yes", "dormitory", "university", "church", "office", "residential", "commercial", "house", "hotel", "apartments", "industrial", "retail", "hospital", "government"]]);

Cheers,

Patrick

Ariadni Michalitsi

unread,
Feb 9, 2021, 8:22:49 AM2/9/21
to GAMA
Dear Benoit,

Thank you for your explanations and your consideration of this issue. 
Please let me know if you have any updates!

All the best,
Ariadni Michalitsi

Ariadni Michalitsi

unread,
Feb 9, 2021, 8:26:29 AM2/9/21
to GAMA
Dear Patrick,

I now saw your reply. Thank you for the explanation.
I will, for now, follow the workaround you suggest!

Best, 
Ariadni 

Patrick Taillandier

unread,
Feb 9, 2021, 8:53:24 AM2/9/21
to gama-p...@googlegroups.com
Hi,

Just an update. Thanks to Benoit, I was able to identify a type of OSM structures poorly imported by GAMA. I'll take care of fixing this tomorrow (it will be available for GAMA users on Thursday I think).


Patrick

Ariadni Michalitsi

unread,
Mar 9, 2021, 11:44:47 AM3/9/21
to GAMA
Dear Patrick, 

Did you have the chance to work on that error?
I tried the workaround you suggested, but with no success. 
In particular, we converted filtered amenities into building agents. 
The problem with that is that, for this area of the NTUA campus, many things are defined as university amenities (such as parking spaces, wifi hotspots, etc) which are not buildings. 
As a result, when we incorporate university amenities into the simulation, buildings are created that are not buildings, and the simulation collapses.

I tried using shapefiles instead, to skip that problem. 
But, not being familiar with this type of files, I tried extracting my area of interest from BBBike (https://extract.bbbike.org/), and also converting its .osm file to shapefile using MyGeodata Cloud converter (https://mygeodata.cloud/). 
Both options had the same problem. The "buildings.shp" and the  "roads.shp" that I am getting from these actions probably do not contain the full graph (that is my guess), because most agents do not move at all and their path (by inspection of them) is always nil. 
I tested the same code to your shapefiles from the tutorials and everything works fine. 
So, my other question is if you have any other suggestion about how to get the shapefiles of areas of interest to be used in GAMA, if my approach is not the best one.
Please excuse my ignorance.

All the best,
Ariadni 

On Tuesday, February 9, 2021 at 5:09:16 AM UTC+2 Patrick Taillandier wrote:

Srirama Bhamidipati

unread,
Mar 11, 2021, 7:27:20 AM3/11/21
to GAMA
Hi Ariadni,

This problem was fixed on February 9 by Patrick. Did you try updating GAMA? or may be downloading the latest GAMA? and then try your exercise ? 
I hope the update solves your problem. 

Srirama

Ariadni Michalitsi

unread,
Mar 17, 2021, 7:01:49 AM3/17/21
to GAMA
Hello Srirama, 

Thank you for your answer! I downloaded the latest GAMA and ran the simulation, but the problem remains. 
There might be that some buildings have been added (I am not sure), but there are still lots missing.
I also attach two screenshots, one for the NTUA campus, using shapefiles and one by using .osm data to see the difference. 
Based on the changes you have made, should I have seen more than the ones that appear in the screenshot?

I would switch to the shapefiles to get my job done, but they do not work either. All buildings are created as they should have, but the agents do not move properly. 
This happens with all shapefiles that I am creating (downloaded from either BBBike or MyGeodata). There should probably be a problem with the shapefiles I am using and the way I extract them? I also attach the shapefiles for your reference.

Thank you for all your support!

Best, 
Ariadni 
NTUA Shapefiles.zip
NTUA_from_shapefiles.jpg
NTUA from osm.jpg
NTUA_osm.PNG

Quang Nghi HUYNH

unread,
Mar 17, 2021, 8:05:03 AM3/17/21
to gama-p...@googlegroups.com
I will take a look if gama updates is still working

Quang Nghi HUYNH

unread,
Mar 17, 2021, 9:14:35 AM3/17/21
to gama-p...@googlegroups.com
Hi,
This release is built Feb 24, so if the fix is Feb 9, it should be fine. Release Continuous build · gama-platform/gama (github.com)



--
-------
HUYNH Quang-Nghi, Ph.D.
Lecturer
CICT - CTU,  Can Tho, Viet Nam

Core Developer of GAMA modeling and simulation platform

[Vietnam] +84909128322


Ariadni Michalitsi

unread,
Mar 17, 2021, 10:05:23 AM3/17/21
to gama-p...@googlegroups.com
Hello,

You are right. I haven't used the latest release. Many thanks!! The problem is solved now. 

Best, 
Ariadni

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/xDyKRqK4HF0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gama-platfor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gama-platform/CANNWKoep68RVpYdiuqkiKO2CNG2DYuQPt4o1DiMEf%3DRxt%2B5KqQ%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages