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

fillCell vectorial with strategy "mode" #802

Open pedro-andrade-inpe opened 8 years ago

pedro-andrade-inpe commented 8 years ago

Implement strategy "majority" for fillCell with vectorial data. #788. Note that this strategy will use two internal TerraLib functions,HIGHEST_OCCURRENCE and HIGHEST_INTERSECTION.

pedro-andrade-inpe commented 8 years ago

@avancinirodrigo, could you check if this strategy is executing the same operator of strategy min, please?

avancinirodrigo commented 8 years ago

No

local OperationMapper = {
    intersection = binding.HIGHEST_INTERSECTION,
    occurrence = binding.HIGHEST_OCCURRENCE,
}
    elseif operation == "mode" then
        if area then 
            operation = "intersection"
        else
            operation = "occurrence"
        end
pedro-andrade-inpe commented 8 years ago

It looks very strange. In te::attributefill::VectorToVectorMemory::getModeValue, the returning value is a string, in the same way of RasterToVector. @avancinirodrigo, can you debug to check which function is really called? The test is in terrame/packages/terralib/tests/shapefile/basics/Layer.lua, in MODE.

avancinirodrigo commented 8 years ago

@pedro-andrade-inpe how could I verify this problem? what are the steps?

pedro-andrade-inpe commented 8 years ago

In terrame/packages/terralib/tests/shapefile/basics/Layer.lua, line 91, in cl:fill, check which terralib operation is being called in its C++ code.

avancinirodrigo commented 8 years ago

Where is created the municipios variable in the test?

        cl:fill{
            operation = "mode",
            name = municipios, -- < this
            attribute = "polmode",
            select = "POPULACAO_",
            output = polmodeLayerName
        }
avancinirodrigo commented 8 years ago

In fact, this operation is working like minimum, but the problem happens in terraview as well

pedro-andrade-inpe commented 8 years ago

@avancinirodrigo, can you replace HIGHEST_OCCURRENCE by MODE? It is necessary to update VectorAttributeCreatedMapper with the code in the C++ level, and I don't know where is it. I then can see if it is working properly.