I'm trying to make an image with MapServer which only displays one layer with a label. I have written the following mapfile:
MAP
NAME "TextLayer"
IMAGETYPE PNG
EXTENT -180 -90 180 90
IMAGECOLOR 0 0 255
PROJECTION
"init=epsg:4269"
END
WEB
METADATA
"ows_title" "WMS service"
"ows_onlineresource" "XXX.XXX.XXX.XXX"
"ows_enable_request" "*"
"ows_crs" "EPSG:4269"
END
END
LAYER
NAME "labellayer"
STATUS ON
TYPE POINT
FEATURE
POINTS 100 100 END
TEXT "The text on the image"
END
CLASS
LABEL
SIZE 8
ANTIALIAS true
COLOR 255 0 0
POSITION cc
END
END
END
END
I am generating the image with PHP with ms_newMapObjFromString(). However, all I get is a transparent image without any text. What am I missing?
EDIT: PHP Code:
public function PrintImage($request, $mapFileString)
{
$mapServer_MapObject = ms_newMapObjFromString($mapFileString);
ms_ioinstallstdouttobuffer();
$mapServer_MapObject->owsdispatch($request);
$contenttype = ms_iostripstdoutbuffercontenttype();
ms_iostripStdoutBufferContentType();
//If content type is 'image/png' the image is succesfully requested -> show the image
if($contenttype == "image/png")
{
header('Content-type: image/png');
echo ms_iogetstdoutbufferbytes();
}
//Else an error occured -> show the error
else
{
header('Content-type: xml');
echo ms_iogetstdoutbufferstring();
}
}
$MapFileString is the string posted above.