Opened 19 years ago

Last modified 14 years ago

#1021 closed defect

Raster Query ignores some classification methods. — at Initial Version

Reported by: warmerdam Owned by: warmerdam
Priority: high Milestone:
Component: MapServer C Library Version: 4.3
Severity: normal Keywords: raster query classified
Cc:

Description

The raster query stuff tries to apply classification to the raw raster values,
but does not take in account query expressions on [red], [green] and [blue], only
those that are based on the raw value. 

For an example look at the result of msautotest/mspython/rqtest - test 
rqtest_13. Currently it finds no results to the point query on the grid 
line because the grid line is classified in msautotest/gdal/classtest1.map
as follows:

  CLASS 
    NAME "Grid"
    EXPRESSION ([red] == 96 and [green] == 32 and [blue] == 32)
    COLOR 255 0 0
  END

As opposed to the text for instance, which does work fine:

  CLASS 
    NAME "Text"
    EXPRESSION ([pixel] == 0)
    COLOR -255 -255 -255
  END

The problem is that the classification handling code in maprasterquery.c
is overly simplistic:

/* -------------------------------------------------------------------- */
/*      Handle classification.                                          */
/* -------------------------------------------------------------------- */
    if( rlinfo->qc_class != NULL )
    {
        int p_class = msGetClass_Float(layer, values[0] );

        if( p_class == -1 )
            nodata = TRUE;
        else
        {
            rlinfo->qc_class[rlinfo->query_results] = p_class;
            red   = layer->class[p_class].styles[0].color.red;
            green = layer->class[p_class].styles[0].color.green;
            blue  = layer->class[p_class].styles[0].color.blue;
        }
    }

However the solution will be pretty involved I think, so I am just submitting
this bug report for now to keep track of the issue. 

In particular, I am not keen on trying to fix this for the 4.4 release.

Change History (0)

Note: See TracTickets for help on using tickets.