[mapserver-users] PHP Mapscript Swig
Sven Schroeter
schroeter at netgis.de
Fri May 10 08:17:26 PDT 2019
Hi,
sorry for the cross-post, but maybe there's someone here who doesn't
read the ms4w list...
I'm using the new MS4W 4.0.0 and try to build a WMS Wrapper for the new
PHP Mapscript with Swig.
I am currently writing the complete PHP mapscript code from my client so
that it runs with both versions, so far this works fine,
msIO_getStdoutBufferBytes() is the only problem so far...
Here is my Test Code for the last MS4W 3.3.0 with old PHP Mapscript
This works fine trying two example requests with getCapabilities and getMap
#############################################
...
$oMap= ms_newMapObj($mymapfile);
ms_ioinstallstdouttobuffer();
$request = ms_newowsrequestobj();
//Get Request
foreach ($_GET as $k=>$v) {
$request->setParameter($k, $v);
}
$oMap->owsdispatch($request);
$oMap->free();
unset($oMap);
$contenttype = strtolower(ms_iostripstdoutbuffercontenttype());
//Capabilities Request
if ($contenttype == "application/vnd.ogc.wms_xml; charset=utf-8"){
header('Content-type: application/xml; charset=utf-8');
echo ms_iogetstdoutbufferstring();
}
//getMap jpeg
else if ($contenttype == 'image/jpeg'){
header('Content-type: image/jpeg');
echo ms_iogetStdoutBufferBytes();
}
...
and here ist the same Code using the new Swig Version:
The getCapabilities Request works fine, not the getMap Request.
I get no picture but only this text:
Resource id #7
#############################################
...
include("../includes/phpmapscriptng-swig/mapscript.php");
$oMap= new mapObj($mymapfile);
msIO_installStdoutToBuffer();
$request = new OWSRequest();
//Get Request
foreach ($_GET as $k=>$v) {
$request->setParameter($k, $v);
}
$oMap->OWSDispatch($request);
unset($oMap);
$contenttype = strtolower(msIO_stripStdoutBufferContentType());
//Capabilities Request
if ($contenttype == "application/vnd.ogc.wms_xml; charset=utf-8"){
header('Content-type: application/xml; charset=utf-8');
echo msIO_getStdoutBufferString();
}
//getMap jpeg
else if ($contenttype == 'image/jpeg'){
header('Content-type: image/jpeg');
echo msIO_getStdoutBufferBytes();
}
...
Any idea?
Thanks Sven
More information about the MapServer-users
mailing list