CityScope / CS_GAMABrix

1 stars 0 forks source link

Road network from OSM? #4

Open crisjf opened 3 years ago

crisjf commented 3 years ago

In the Road Traffic model, the example uses a street network imported from a shapefile here. Is there a way of importing the road network for the given table from GAMA?

agrignard commented 3 years ago

Yes there is this feature in GAMA and it's actually already written in this repo https://github.com/CityScope/CS_Simulation_GAMA. It would be great to have this feature. I would say not by defautl as the first toy model should be only dealing with what is present in the GEOGRID but if we have the possibility to link it to an OSM layer that would be great.

The code is already written here https://github.com/CityScope/CS_Simulation_GAMA/blob/master/CS_CityScope_GAMA/models/VisualizationToolKit/OSM_Loader_Model.gaml

That's also the kind of reason why I was wondering if we should create a new repo for GAMABrix as there are some utilities that could be reuse in the initial repo by just including it.

crisjf commented 3 years ago

It seems that this model doesn't download the OSM data from the OSM API, but rather loads it from a file. Is this right @agrignard ?

agrignard commented 3 years ago

No i think you have the 2 option, either you have an osm and if not it gives the possibility to donwlaod the osm by providing the top left and top right of the table


        if (file_exists(osm_file_path)) {
            osmfile  <- osm_file(osm_file_path, filtering);
        } else {
            point top_left <- CRS_transform({0,0}, "EPSG:4326").location;
            point bottom_right <- CRS_transform({shape.width, shape.height}, "EPSG:4326").location;
            string adress <-"http://overpass.openstreetmap.ru/cgi/xapi_meta?*[bbox="+top_left.x+"," + bottom_right.y + ","+ bottom_right.x + "," + top_left.y+"]";
            osmfile <- osm_file<geometry> (adress, filtering);
        }