wiki:WMSWrapper

Version 18 (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 == "text/xml; charset=utf-8"){
    header('Content-type: application/xml; charset=utf-8');
    echo msIO_getStdoutBufferString();
}

## GetMap png
else if ($contenttype == 'image/png'){
    header('Content-type: image/png');
    echo msIO_getStdoutBufferBytes();
}


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

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