Opened 18 years ago

Last modified 12 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


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/
as follows:

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

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

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

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;
            rlinfo->qc_class[rlinfo->query_results] = p_class;
            red   = layer->class[p_class].styles[0];
            green = layer->class[p_class].styles[0];
            blue  = layer->class[p_class].styles[0];

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.