[Chameleon-dev] [Bug 1222] Query widget hilite raster fatal error

bugzilla-daemon at bugzilla.maptools.org bugzilla-daemon at bugzilla.maptools.org
Tue Dec 20 13:06:10 EST 2005


------- Additional Comments From mcgrawj at agr.gc.ca  2005-12-20 13:06 -------
My solution code follows. It essentially just removes any raster layers from 
the QueryLayers list before setting them in the MapQuery. Since I was removing 
items from the array, I turned the for loop around to evaluate layers from the 
end to the beginning. 
Also, I found that the first half of the if/else block that follows wasn't 
working in the original code (it was passing a layer name to MapServer's 
getLayer(), which expects an index number). I've fixed it and tested it as much 
as I is required for my purposes. Someone who knows more about it might want to 
review, but certainly something is better than nothing getting highlighted, 
which is what was happening before.

In drawmap.php's runQuery(), there is an if/else block ( $szQueryLayers !
= "?" ). The following code should replace the code existing there (at least in 
my version of Chameleon drawmap.php which is from 2.2 I believe):

    // check to see if the list of layers has been supplied
    if ( $szQueryLayers != "?" )
        // get array of layers
        $aszLayers = explode(",", $szQueryLayers );

        // loop and get the name of each layer
        for ( $i=count($aszLayers)-1; $i>-1; $i-- )
            // get layer
            $oLayer = $oMap->getLayerByName( $aszLayers[$i] );

            if ( $oLayer->type == MS_LAYER_RASTER ){
                // remove the layer from the query
            } else {
                // update array to be name
                $aszLayers[$i] = $oLayer->name;
        // loop through all layers and add to list of layers to query
        // NOTE:  Layers will only have results generated for them if they
        // have a "template" value set.  The template value does not have
        // to be valid, it could be as simple as "ttt".
        $nCount = $oMap->numlayers;
        for ( $i=0; $i<$nCount; $i++ )
            // get layer name
            $oLayer = $oMap->getLayer( $i );

            // only add if on and not a raster
            if ( $oLayer->type != MS_LAYER_RASTER && ( $oLayer->status == MS_ON 
|| $oLayer->status == MS_DEFAULT ))
                array_push( $aszLayers, $oLayer->name );

    // commit

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

Please do NOT reply to this email, use the link above instead to 
login to bugzilla and submit your comment. Any email reply to this
address will be lost.

More information about the Chameleon-dev mailing list