CityScope / CSL_Guadalajara

Repository for the CityScope project related to Guadalajara Collaboration
GNU General Public License v3.0
2 stars 4 forks source link

Digital Elevation Model #16

Closed agrignard closed 4 years ago

agrignard commented 4 years ago

Add a digital Elevation Model using this model as an example in the GAMA model library Data/Data Importation/models/Grid DEM.gaml

agrignard commented 4 years ago

@LeticiaIG @gamalielpalomo any update on this part?

gamalielpalomo commented 4 years ago

3D buildings and DEM almost done, working on agents following the terrain (3D moving).

LeticiaIG commented 4 years ago

[https://github.com/CityScope/CSL_Guadalajara/issues/15#issuecomment-606503249] The terrain was obtained through Google Earth. I used a gh component which with the input of a WSG84 coordinate set, queries the Google elevation API and returns the elevation coordinates. And from there, triangulating the points, I built the mesh. So perhaps the representation was not very accurate. Now I am working with a .asc obtained from https://portal.opentopography.org/rasterOutput?jobId=rt1585694003893. (just sent the .asc file to Gamal) Since we did not have the buildings inside the blocks, these were drawn by hand, so a shapefile had to be created from the resulting polygons. I've already accomplished that, now I'm squaring it so that altitude and depth fields in the new shapefile are consistent with the terrain

gamalielpalomo commented 4 years ago

I don't know if I am using the syntax correctly. Does the facet "elevation:true" allow to show each cell elevation? I am using it with an .asc file and seems dont work

agrignard commented 4 years ago

@gamalielpalomowhich .asf file are you mentionning? is it in the github?

Yes the elevation:"valueToVisualize is here to show the elevation if you specify which value you want to map (in this case valueToVisualize)

Can you try with this model and just replacing hab10 by your .asc

/**
* Name: ESRI ASCII to grid model
* Author:  Patrick Taillandier
* Description: Model which shows how to initialize a grid using a ESRI ASCII file
* Tags: grid, load_file, asc
*/

model ascimport

global {
    //definiton of the file to import
    file grid_data <- file('../includes/hab10.asc') ;

    //computation of the environment size from the geotiff file
    geometry shape <- envelope(grid_data);  
}

//definition of the grid from the asc file: the width and height of the grid are directly read from the asc file. The values of the asc file are stored in the grid_value attribute of the cells.
grid cell file: grid_data{
    init {
        color<- grid_value = 0.0 ? #black  : (grid_value = 1.0  ? #green :   #yellow);
    }
}

experiment gridloading type: gui {
    output {
        display "As DEM" type: opengl{
            grid cell lines: #gray elevation: grid_value * 300 ;
        }

        display "As 2D grid"  type: java2D {
            grid cell lines: #black;
        }
    } 
}
gamalielpalomo commented 4 years ago

It works! I'am uploading the latest version

agrignard commented 4 years ago

Great!!! Good job, it look great!

Screen Shot 2020-04-06 at 22 42 51