Creating shapefiles from OSM data

62 views
Skip to first unread message

Damien V.

unread,
Dec 6, 2019, 7:54:52 AM12/6/19
to GAMA
Hi,

I'm trying to use custom shapefiles for the Simple Traffic Model from the Toy Models library.
I followed the tutorial from this page (I did the same procedure to extract roads but selecting Polylines instead of Polygons when exporting to SpatiaLite).
From the raw OSM export, I kept only roads that cars can go onto with the following osmfilter command :

osmfilter $1 --keep="highway=primary =secondary =motorway =trunk =tertiary =residential =unclassified =living_street =road =motorway_link =trunk_link =primary_link =secondary_link =tertiary_link =service building=" --drop="highway=service and ( bus=yes or bus=designated )" > filtered_$1

However, when I load the two shapefiles (buildings and roads) instead of the default ones into the simulation, only a few vehicles move to their destination, which is very odd because I didn't change the source code.
Maybe something went wrong during the export ?

I even tested without running the filtering command, but I got the same strange behavior as described above.

You'll find attached the files I used (roads and buildings of Université Paul Sabatier, Toulouse, France).

Thanks.
buildings.dbf
roads.shx
buildings.prj
buildings.qpj
buildings.shp
buildings.shx
roads.dbf
roads.prj
roads.qpj
roads.shp

Benoit Gaudou

unread,
Dec 8, 2019, 10:18:34 PM12/8/19
to gama-p...@googlegroups.com
Hi Damien,

The case of having very few or no vehicles moving on a road network often comes from the road shapefile, with, in particular, 2 specific causes:
- there are several connex components
- the intersections between the roads are not well computed.

If there are 2 connex components, a véhicule that has chosen a target for which the closest road is not in the same connex component than the closest road to its current location, 
will not move as it is not possible to find a path in the graph between its location and its target.

There is an interesting model in the GAMA model library: Data / Data Cleaning / Clean Line Network.gaml.
When using it you can, clean your road network (in case the intersections between the roads was not well computed), and show the connex components.
You can then save the road you want.

As an example, in the attached model, I modify the original model to:
(1) save the roads in a shapefile
(2) run 2 simulations: one keeping only the main connex component and the other keeping all the roads.

If you try to use each of these roads files, with the Simple traffic model, you will see that in one case all the vehicles will move and not in the second case.

I hope it helps.

Cheers

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 on the web visit https://groups.google.com/d/msgid/gama-platform/9967cf24-6aef-454d-a4a1-755b30630568%40googlegroups.com.
Clean Line Network.gaml

Benoit Gaudou

unread,
Dec 9, 2019, 1:12:41 AM12/9/19
to gama-p...@googlegroups.com
Hi Damien,

Looking more carefully the data generated by the GAMA model, it seems that something went wrong with the cleaner model.
In particular, the version with only the main connex component has removed too many roads.
But I admit I do not know why ... I think I will post an issue on that point.

Benoit

Damien V.

unread,
Dec 9, 2019, 3:59:52 AM12/9/19
to GAMA
Hi,

I ran the Clean Line Network model on my side and the road network is indeed composed of several connex components. I checked again on OSM and all roads appear to be connected correctly to each other. That's very strange… Same problem with the raw data, but the components are different and the model keeps more roads.
To unsubscribe from this group and stop receiving emails from it, send an email to gama-p...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages