Superimpose grid ad shape file

48 views
Skip to first unread message

Etienne DELAY

unread,
Jul 20, 2017, 6:49:10 AM7/20/17
to GAMA
Dear all, 
I would like load shape file and and a grid in tif. Both of them are in WGS84 (EPSG 4326). When I load it in Gama the projection doesn't work ...
Where I'm wrong ?

global{ //Declare the world as a torus or not torus environment
//Shapefile of country
file country_shapefile <- file("../includes/world_shape/europ_migration.shp");
// Raster
file dem_file <- file("../includes/dem/dem_resemple50.tif") ;
init{
create country from: country_shapefile;
create events from: event_shapefile with: [ev_type::string(read("event"))];
}
}

species country {
aspect default {
draw shape color: nil border: #black;
}
}

//Grid species representing a cellular automata
grid dem_cell file:dem_file {
float elevation ;
init{
if(grid_value > 0){
elevation <- grid_value;
}
}
rgb pcolor <- blend(#black,#white, elevation);
aspect col_elevation{
draw shape color:pcolor border:#black empty:false;
}
}

xperiment courlisabstract type: gui {
/** Insert here the definition of the input and output of the model */
output {
display sp_display type: opengl{
grid dem_cell ;
species dem_cell aspect: col_elevation;
species country refresh: false;
}
}
}

E.
Capture d'écran de 2017-07-20 10-41-48.png
map.png

Patrick Taillandier

unread,
Jul 20, 2017, 7:28:17 AM7/20/17
to gama-p...@googlegroups.com
Hi,

You have to define the size of the world from the tiff file: in the global section :
geometry shape <- envelope(dem_file);

--
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 post to this group, send email to gama-p...@googlegroups.com.
Visit this group at https://groups.google.com/group/gama-platform.
For more options, visit https://groups.google.com/d/optout.

Etienne DELAY

unread,
Jul 20, 2017, 7:36:13 AM7/20/17
to GAMA
Re, 
Done thank you !
E.

Etienne DELAY

unread,
Jul 20, 2017, 7:44:07 AM7/20/17
to GAMA
Arg, 
In fact ... non better but not well superimposed :-S
E.
Capture d'écran de 2017-07-20 11-42-59.png

Patrick Taillandier

unread,
Jul 20, 2017, 7:50:02 AM7/20/17
to gama-p...@googlegroups.com
Ok, it is maybe because GAMA has some difficulties when projecting grids: indeed, GAMA only works with projected CRS, so when you are using non projected one (typically WGS84), GAMA tries to project it with a UTM projection.... but the way the grids are managed in GAMA could have an impact on the resulting geometries after projection. Can you try to change the CRS of the tiff file to a projected one (UTM for instance) with QGIS, and test with this projected grid in GAMA?


To unsubscribe from this group and stop receiving emails from it, send an email to gama-platform+unsubscribe@googlegroups.com.

Etienne DELAY

unread,
Jul 20, 2017, 7:56:45 AM7/20/17
to GAMA
Need I project grid and shape(s) in UTM ?

Patrick Taillandier

unread,
Jul 20, 2017, 8:05:40 AM7/20/17
to gama-p...@googlegroups.com
just the grid should be enough

To unsubscribe from this group and stop receiving emails from it, send an email to gama-platform+unsubscribe@googlegroups.com.

Etienne DELAY

unread,
Jul 20, 2017, 8:11:52 AM7/20/17
to GAMA

Which UTM  epsg do you counsel for project European stuff?

Patrick Taillandier

unread,
Jul 20, 2017, 8:24:17 AM7/20/17
to gama-p...@googlegroups.com
Maybe, for Europe, you should rather use a CRS like ETRS89 / ETRS-LCC :  (http://spatialreference.org/ref/epsg/etrs89-etrs-lcc/)

To unsubscribe from this group and stop receiving emails from it, send an email to gama-platform+unsubscribe@googlegroups.com.

Etienne DELAY

unread,
Jul 20, 2017, 8:47:32 AM7/20/17
to GAMA
Perfect !
Capture d'écran de 2017-07-20 12-45-23.png
Reply all
Reply to author
Forward
0 new messages