TerraME / terrame

TerraME is a programming environment for spatial dynamical modelling
www.terrame.org
GNU Lesser General Public License v3.0
36 stars 13 forks source link

Problem in Society after integrate to TerraLib 5 #924

Closed avancinirodrigo closed 8 years ago

avancinirodrigo commented 8 years ago

The test in database/Society break after to change to terralib:

        local nonFooAgent = Agent{}

        local soc = Society {
            instance = nonFooAgent,
            database = filePath("brazilstates.shp", "base")
        }

        unitTest:assertEquals(#soc, 27)

I have been thinked that it was happened because load shape was not implemented yet, but after implementation, it still do not work. There is not shape handle in Society. Only this code below exists associeted to CellularSpace.

            local cs = CellularSpace{
                database = data.database,
                port = data.port,
                user = data.user,
                host = data.host,
                dbType = data.dbType,
                password = data.password
            }
            forEachCell(cs, function(cell)
                cell.type_ = "table"
                cell.cObj_ = nil
                data:add(cell)
            end)

I didn't change because I don't know about the behavior. @pedro-andrade-inpe would you have some solution?

pedro-andrade-inpe commented 8 years ago

Did you replace the name of the arguments for CellularSpace (such as dbType) to the newest version?

avancinirodrigo commented 8 years ago

Yes, but the error persists.

Wrong execution, got error: '...rame/bin/packages/base/tests/database/basics/Society.lua:65: Error: Not enough information to build the CellularSpace.'.
pedro-andrade-inpe commented 8 years ago

Which arguments loadShape takes? It seems that none!

registerCellularSpaceDriver{
    source = "shp",
    load = loadShape,
    check = checkShape
}
avancinirodrigo commented 8 years ago
local function loadShape(self)
    local tlib = terralib.TerraLib{}
    local dSet = tlib:getShpByFilePath(self.file)
    setCellsByTerraLibDataSet(self, dSet)
end
pedro-andrade-inpe commented 8 years ago

So it should be

registerCellularSpaceDriver{
    source = "shp",
    load = loadShape,
    compulsory = "file",
    check = checkShape
}

isn't it?

avancinirodrigo commented 8 years ago

Not yet.

pedro-andrade-inpe commented 8 years ago

Use the same strategies of CellularSpace to create a Society when using geospatial data. Call TerraLib directly without passing by CellularSpace.