PHP Mapscript Swig

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

PHP Mapscript Swig

Sven Schroeter
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


_______________________________________________
mapserver-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapserver-users
Reply | Threaded
Open this post in threaded view
|

Re: PHP Mapscript Swig

Seth G-2
Hi Sven,

Probably the same issue as here?
https://github.com/mapserver/mapserver/issues/5798
You could try with the new release candidate for MS 7.4 to see if it is now resolved.

Seth

--
web:http://geographika.co.uk
twitter: @geographika

On Fri, May 10, 2019, at 5:22 PM, Sven Schroeter wrote:

> 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
>
>
> _______________________________________________
> mapserver-users mailing list
> [hidden email]
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
_______________________________________________
mapserver-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapserver-users