[Mapserver-users] PHP Mapscript processtemplate( ) problems

DEAN Jeremy E Jeremy.E.DEAN at Co.Benton.OR.US
Wed Jul 7 22:19:46 EDT 2004


Hello again,

I am having continued problems with the PHP MapScript method of
PROCESSTEMPLATE( ).  I have successfully used a legend template and the
PROCESSLEGENDTEMPLATE( ) method to generate content, but am now also having
trouble replicating that in the code below.

I was worried that I had problems with my installation of PHP or the
MapScript dlls so I built a new server (Windows 2000 sp4).  Installed the
latest and greatest of both PHP (4.3.7) and MapScript (4.2.0).  A PHPINFO( )
call seemingly shows everything to be in order.

With all that I have tried and what I am seeing my feeling is I am leaving
something unitialized properly to allow the template to process.  The images
are generated, the MapScript error object reports no errors (when I
seemingly am using it right), PHP reports no errors, no LOG file is
generated with DEBUG, and all PHP seems to excute (ECHO() statements placed
in amongst the MapScript calls).  The template file can be anything from a
simple line of HTML or a valid template that works with the CGI version of
MapServer, but all return nothing.  If I introduce invalid keys into the
template though, it does generate an error message.

Has anyone had any success with this call, have an example of its use, or
just some advice?  Any help would be greatly appreciated!

Thanks in advance,
Jeremy Dean
Benton County IRM
Programmer/Analyst
[541] 766-6610

This is the most basic example I am trying to get working:

PHP file:
<?PHP

$map = ms_newMapObj("C:\Inetpub\wwwroot\GIS\v09_10\examples\demo.map");

//**added to see if the map object needed to be initialized somehow
$map->set("width", 2000);
$map->set("height", 2000);
$map->setextent(93234, 5205405, 495769, 5307959);
$img = $map->prepareimage();
$img = $map->draw();
//**

//$output = $map->processtemplate(null, MS_TRUE);
$output = $map->processtemplate("", MS_TRUE);
echo("$output");

$outpt=$map->processlegendtemplate(null);
echo("$outpt");

$error = ms_GetErrorObj();
while($error && $error->code != MS_NOERR)
{
	printf("Error in %s: %s<br>\n", $error->routine, $error->message);
	$error = $error->next();
}

?>

MAP file:
NAME TEST
DEBUG ON
STATUS ON
SIZE 600 600
EXTENT 388107.634400379 5203120.88405952 500896.339019834 5310243.30613897
UNITS METERS

WEB
  TEMPLATE test.htm
  #MINSCALE 1000
  #MAXSCALE 1550000
  IMAGEPATH "c:\Inetpub\wwwroot\GIS\v09_10\Temp\"
  IMAGEURL "../Temp/"
  LOG "c:\Inetpub\wwwroot\GIS\v09_10\Temp\test.log"
  METADATA

  END
END

LEGEND
  KEYSIZE 18 12
  LABEL
    TYPE BITMAP
    SIZE MEDIUM
    COLOR 0 0 89
  END
  STATUS ON
  Transparent Off
  TEMPLATE "c:\Inetpub\wwwroot\GIS\v09_10\examples\Legend.htm"
END
.
.
Scalebar, Symbol, Layers sections as well




More information about the mapserver-users mailing list