3D simulation (with Z inputs) shows flat surface <- repost as has not yet answers

76 views
Skip to first unread message

rot...@stud.sbg.ac.at

unread,
Jan 30, 2019, 5:10:03 PM1/30/19
to GAMA
Hi all,

I've encountered same issue, like a previous colleague mentioned in his post.

Briefly repetition,

I use two .asc grid species (landcover, DEM) and one .shp (shp_points, which has attributes height, diameter).

When I: ask shp_points { write {location.x,location.y,location.z}; }
output in console is eg. {87.33289999887349,50.411600001156316,0.0}, so my understanding is that it might take into consideration just the landcover (which doesn't have elevation values).

How can I access the Z value, so I have a 3D visualization? Species shape is as cone3D, but displayed everything flat.

p.s. I use in experiment gui, opengl.


Thank you for insight and help,
Rares

Patrick Taillandier

unread,
Jan 31, 2019, 2:42:55 AM1/31/19
to gama-p...@googlegroups.com
Hi,

Could you share your model and data to test it?

Cheers,

Patrick


--
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.

rot...@stud.sbg.ac.at

unread,
Jan 31, 2019, 10:03:46 AM1/31/19
to GAMA
Hi Patrick,

Thanks a lot for having a look!

Please find attached the model file and gis data.
I tested written elevation grid_values and they are printed out,but still flat surface output of experiment. The order of grid species, I've changed and still not satisfying.

Looking forward to hear your opionion,
Rares
tree_growth.gaml
trees_54_100rnd.sbn
trees_54_100rnd.sbx
trees_54_100rnd.shp
trees_54_100rnd.shx
breitldem100.asc
breitldem100.asc.aux.xml
breitl_lul100.asc
breitl_lul100.asc.aux.xml
breitl_lul100.asc.xml
trees_54_100rnd.cpg
trees_54_100rnd.dbf
trees_54_100rnd.prj

rot...@stud.sbg.ac.at

unread,
Feb 5, 2019, 11:39:51 AM2/5/19
to GAMA
hi,

The .asc DEM file is very high above the XYZ navigation frame, making it difficult to visualize.

can please someone have a look at .asc file for visualization?

thank you,
Rares



global {

float altitude_DEM;


string file_input <- "../includes_gis/";

file DEM parameter: "DEM" <- file(file_input + "breitldem100.asc");


// file DEM <- file(file_input + "breitldem100.asc");
geometry shape <- envelope(DEM);


init {

ask elevation {


altitude_DEM <- grid_value;
// write "altitude of cell " + altitude_DEM;

}
}



}



grid elevation file: DEM {


}




experiment baseline type:gui {
output {
display map type: opengl {

grid elevation elevation:true grayscale:true triangulation:true;

}
}
}
breitldem100.asc.aux.xml
breitldem100.asc

Patrick Taillandier

unread,
Feb 6, 2019, 3:01:47 AM2/6/19
to gama-p...@googlegroups.com
Hi,

A simple solution for vizualization purpose is just to decrement the value of grid_value for all the cells by the min grid value:


global {

        float altitude_DEM;


        string file_input <- "../includes/";

        file DEM parameter: "DEM" <- file(file_input + "breitldem100.asc");


//      file DEM <- file(file_input + "breitldem100.asc");
        geometry shape <- envelope(DEM);    

        init {
        float min_altitude <- elevation min_of each.grid_value;

                ask elevation {

                       altitude_DEM <- grid_value;
                //      write "altitude of cell " + altitude_DEM;
grid_value <- grid_value - min_altitude;
                }
        }

}

Cheers,

Patrick

 

rot...@stud.sbg.ac.at

unread,
Feb 13, 2019, 9:54:17 PM2/13/19
to GAMA
Merci Patrick!

I've tried similar (but simpler code :), and didn't work,
because now I see my error in your code example.

I must declare the var e.g. float min_altitude and operators in the init {} block above the ask elevation {}, and not in it or grid species/global.

Another solution that worked was to use Raster Calculator in GIS software, and subtract cell values! "dem" - min_value


But I like more the solution with gama code that you provided.

I've looked at Grid DEM (tutorial model), as it is very detailed, and noticed that as well DEM floats above the XYZ plane, seems like my case too.

In experiment, I've tried with draw function, hoping to achieve a "draping" effect, to overlay landcover on the elevation file, but looks same.

display map type: opengl draw_env: false{
graphics "landcover on elevation" {
draw dem (elevation, landcover, 0.9);
}

the grid file have different grid_value , so that's the reason why they are not on top of eachother, can it be done? I will try to combine them, and share results if i get to.

enjoy reasearching for everybody!

TREELIM_model_display_map_size_1035x680_cycle_0_time_1550090771668.png
TREELIM_model_display_map_size_1429x680_cycle_0_time_1550092549528.png

Patrick Taillandier

unread,
Feb 19, 2019, 3:06:02 AM2/19/19
to gama-p...@googlegroups.com
Hi,

For the moment, it is not possible to achieve the "draping" effect. There are only two (bad) workaround for the moment:
  • change the color of the cells of the grid according to the impact of the other agents.
  • add a "z" value to the location of the agents when displaying them
I will add an issue about the possibility for draping a polygon on a DEM for visualization purpose, but it will take time to add this enhancement. 

Cheers,

Patrick

Reply all
Reply to author
Forward
0 new messages