[Mapserver-users] PHP/MapScript question: mapObj->processquerytemplate()

Daniel Morissette morissette at dmsolutions.ca
Mon Jun 16 06:55:01 PDT 2003


Steven,

It is quite possible that processQueryTemplate() doesn't generate the
images.  The processTemplate() function includes a boolean
'generateimages' flag to request the images to be created, but this flag
is not present in processQueryTemplate().  Perhaps you should file this
in bugzilla.

Daniel



Steven Monai wrote:
> 
> Hello folks:
> 
> I am using a Windows build of PHP/MapScript (v3.7) with PHP (v4.3.0) and
> Apache (v2.0.45), and I can't get the processquerytemplate() method of
> mapObj to work as I expect it should. Specifically, my query template
> includes an [img] tag, which works just fine when processed by the
> MapServer CGI. The problem I'm having is that in PHP, the
> processquerytemplate() method of mapObj replaces the [img] tag with an
> image filename (as it should), but for some reason, the file itself is
> not generated! Here are snippets of the relevant PHP code to illustrate
> what I'm doing (irrelevant details have been replaced with ellipses):
> 
> /* Beginning of (pseudo-)code fragment */
> 
> $map = ms_newMapObj($myMapFileName);
> $map->setextent(...);
> $queryBox = ... ; // This is a rectObj, in map coordinates
> 
> /*
>  * Turn on all non-default layers.
>  */
> for ($i = 0; $i < $map->numlayers; $i ++) {
>   $layer = $map->getLayer($i);
>   if ($layer->status == MS_OFF) {
>     $layer->set('status', MS_ON);
>   }
> }
> 
> /*
>  * Run the query and produce the output web page
>  */
> $queryResult = @$map->queryByRect($queryBox);
> if ($queryResult == MS_SUCCESS) {
>   echo $map->processquerytemplate($_REQUEST);
> }
> else { // query found nothing
>   readfile($emptyQueryURL);
> }
> 
> /* End of fragment */
> 
> Any helpful pointers or suggestions would be greatly appreciated. I want
> to avoid having to modify my query templates, if at all possible, so
> that they can function unchanged in both PHP/MapScript and the MapServer
> CGI.
> 
> Thanks,
> -SM
> --
> ============================================
> Steven Monai
> Database & Application Developer
> Spatial Mapping Ltd.
> 484 2nd Avenue
> Prince George, BC, Canada
> V2L 2Z7
> 
> http://www.spatialmapping.com
> mailto:stevem at spatialmapping.com
> phone: 250 564 1928
> fax: 250 564 0751
> ============================================
>



More information about the MapServer-users mailing list