[mapserver-users] Re: queryUsingPoint queryUsingRect don't work

Daniel Morissette morissette at dmsolutions.ca
Tue Jun 5 10:34:25 EDT 2001


Olaf Czogalla wrote:
> 
> Actually I'm trying to use  queryUsingPoint  and queryUsingRect on a layer
> with no results. Yes, there are QUERYITEM  and QUERY defined
> in the mapfile.
> 
> I was wondering why theLayer->queryUsingRect always causes the
> PHP-Module to crash since the Map->queryUsingRect results no error
> but no resultObj.
> 
> Here is the code of the mapfile and phtml-file:
> 
> -----------
> LAYER
>   NAME Str_nam
>   TYPE Annotation
>   STATUS ON
>   DATA anno_amt
>   CLASSITEM level
>   LABELITEM str_name
>   LABELCACHE on
>   LABELMAXSCALE 12000
>   QUERYITEM str_name
>   QUERY
>      TEMPLATE "foo"
>   END
>   SYMBOLSCALE 6000
>   CLASS
> .
> .
> .
> --------------------------
> 
>         {       $theLayer = $Map->getLayerByName ("Str_nam");
>                 $theLayer->status = MS_ON;
>                 $theQuery = ms_newQueryObj ($theLayer);
>                 $theQuery->setExpression("/Himbeerweg/");
> 

Olaf,

I think there was a problem in version 3.4 and previous versions that
you may have triggered here and would cause your crash.  The problem was
that if a layer has more than one queryObj and one of the queryObj has a
NULL expression then Mapserver will seg.fault during the query call.  

That's what you have here:

1- Your mapfile contains a queryobj with an empty (i.e. NULL)
expression:

   QUERY
      TEMPLATE "foo"
   END

2- Your PHP code creates a second queryObj and sets an expression for
it:

                $theQuery = ms_newQueryObj ($theLayer);
                $theQuery->setExpression("/Himbeerweg/");

Unfortunately there was no way to access existing queryObj from the
mapfile in v3.4 mapscript... so the fix is either you set a dummy
expression in the QUERY object in the mapfile or you simply take out the
QUERY object from the mapfile.

-- 
------------------------------------------------------------
 Daniel Morissette               morissette at dmsolutions.ca
 DM Solutions Group              http://www.dmsolutions.ca/
------------------------------------------------------------
  Don't put for tomorrow what you can do today, because if 
      you enjoy it today you can do it again tomorrow.




More information about the mapserver-users mailing list