[Mapserver-users] PHP/MapScript question: mapObj->processquerytemplate()
Steven Monai
stevem at spatialmapping.com
Fri Jun 13 12:20:02 PDT 2003
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