Changes between Initial Version and Version 1 of WMSWrapper


Ignore:
Timestamp:
2019-05-10T18:25:46-03:00 (6 years ago)
Author:
Jeff McKenna
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • WMSWrapper

    v1 v1  
     1 - source: https://lists.ms4w.com/pipermail/ms4w-users/2019-May/000343.html
     2 - note: likely solution is included in next MapServer release:
     3
     4----
     5
     6== SWIG MapScript (currently fails) ==
     7{{{
     8#!php
     9include("../includes/phpmapscriptng-swig/mapscript.php");
     10$oMap= new mapObj($mymapfile);
     11
     12msIO_installStdoutToBuffer();
     13
     14$request = new OWSRequest();
     15
     16//Get Request
     17foreach ($_GET as $k=>$v) {
     18    $request->setParameter($k, $v);
     19}
     20
     21$oMap->OWSDispatch($request);
     22
     23unset($oMap);
     24
     25$contenttype = strtolower(msIO_stripStdoutBufferContentType());
     26
     27//Capabilities Request
     28if ($contenttype == "application/vnd.ogc.wms_xml; charset=utf-8"){
     29    header('Content-type: application/xml; charset=utf-8');
     30    echo msIO_getStdoutBufferString();
     31}
     32
     33//getMap jpeg
     34else if ($contenttype == 'image/jpeg'){
     35    header('Content-type: image/jpeg');
     36    echo msIO_getStdoutBufferBytes();
     37}
     38}}}
     39
     40== Old MapScript ==
     41{{{
     42#!php
     43$oMap= ms_newMapObj($mymapfile);
     44
     45ms_ioinstallstdouttobuffer();
     46
     47$request = ms_newowsrequestobj();
     48
     49//Get Request
     50foreach ($_GET as $k=>$v) {
     51    $request->setParameter($k, $v);
     52}
     53
     54$oMap->owsdispatch($request);
     55$oMap->free();
     56unset($oMap);
     57
     58$contenttype = strtolower(ms_iostripstdoutbuffercontenttype());
     59
     60//Capabilities Request
     61if ($contenttype == "application/vnd.ogc.wms_xml; charset=utf-8"){
     62    header('Content-type: application/xml; charset=utf-8');
     63    echo ms_iogetstdoutbufferstring();
     64}
     65
     66//getMap jpeg
     67else if ($contenttype == 'image/jpeg'){
     68    header('Content-type: image/jpeg');
     69    echo ms_iogetStdoutBufferBytes();
     70}
     71}}}