wiki:WMSWrapper

Version 17 (modified by Jeff McKenna, 3 years ago) ( diff )

--

WMS Wrapper example

SWIG MapScript (MS4W 5.x)

  • name the following file 'wms-wrapper.php'
<?php

$oMap= new mapObj("/ms4w/apps/local-demo/local.map");

## Ready stdout for data capture
msIO_installStdoutToBuffer();

## Create OWS Request object
$request = new OWSRequest();

## Get Request
foreach ($_GET as $k=>$v) {
    $request->setParameter($k, $v);
}

## Dispatch request
$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();
}


## Reset handler and cleaup added
msIO_resetHandlers();
msCleanup();

?>
Note: See TracWiki for help on using the wiki.