wiki:WMSWrapper

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();

?>
Last modified 3 years ago Last modified on 2021-12-22T12:17:54-04:00
Note: See TracWiki for help on using the wiki.