[mapserver-users] MapServer 6.4.1 OGR output error

Bruno D bruno.domenget at rochservice.com
Wed Nov 12 08:57:14 PST 2014


Hi everyone,

I'm using MapServer on a CentOS 6 server, everything works fine except for
the OGR output. When I try to select an outputformat that uses OGR, I always
get the following errors (and nothing more, making debugging really
difficult) :
*msDrawMap() : Unable to initialize image.
msPrepareImage() : Unable to initialize image.*

I tried a lot of things but I still haven't found the source of this
problem, does anyone have any idea ?

Thanks !

Server configuration :
*MapServer 6.4.1
GDal 1.9.2 (also tried with GDal 1.8.1)*

Example of a mapfile I'm trying to output (PNG and KMZ work fine, the other
formats don't) :

/MAP
NAME "TOTO"
SIZE 1000 600
STATUS ON
SYMBOLSET "./symbols.txt"
EXTENT -10 40 9 51
UNITS DD
SHAPEPATH "./shapefiles"

CONFIG "MS_ERRORFILE" "./erreurs_mapserver.txt"
CONFIG "CPL_DEBUG" "ON"
CONFIG "PROJ_DEBUG" "ON"
DEBUG 5

PROJECTION
   "init=epsg:4326"
END

WEB
	IMAGEPATH "./output/"
	IMAGEURL "./output/"
END # WEB

OUTPUTFORMAT
  NAME "png"
  DRIVER AGG/PNG
  MIMETYPE "image/png"
  IMAGEMODE RGB
  EXTENSION "png"
END

OUTPUTFORMAT
	NAME "kmz"
	DRIVER KMZ
	MIMETYPE "application/vnd.google-earth.kmz"
	IMAGEMODE RGB
	EXTENSION "kmz"
	FORMATOPTION "maxfeaturestodraw=1000000000"
END

OUTPUTFORMAT
	NAME "CSV"
	DRIVER "OGR/CSV"
	MIMETYPE "text/csv"
	FORMATOPTION "LCO:GEOMETRY=AS_WKT"
	FORMATOPTION "STORAGE=filesystem"
	FORMATOPTION "FORM=simple"
	FORMATOPTION "FILENAME=result.csv"
END

OUTPUTFORMAT
	NAME "SHAPEZIP"
	DRIVER "OGR/ESRI Shapefile"
	FORMATOPTION "STORAGE=memory" 
	FORMATOPTION "FORM=zip" 
	FORMATOPTION "FILENAME=result.zip" 
END

OUTPUTFORMAT
	NAME "MIDMIF"
	DRIVER "OGR/MapInfo File"
	FORMATOPTION "STORAGE=filesystem"
	FORMATOPTION "FORM=multipart"
	FORMATOPTION "DSCO:FORMAT=MIF"
	FORMATOPTION "FILENAME=result.mif"
END

OUTPUTFORMAT
	NAME "DXF"
	DRIVER "OGR/DXF"
	FORMATOPTION "STORAGE=filesystem"
	FORMATOPTION "FORM=zip"
	FORMATOPTION "FILENAME=result.csv"
END   
  
  LAYER
    DATA "Bati"
    METADATA
      "ows_title"	"Bati"
    END # METADATA
    NAME "Bati"
    STATUS ON
    TILEITEM "location"
    TYPE POLYGON
    UNITS METERS
    CLASS
      NAME "Bati"
      STYLE
        ANGLE 0
        COLOR 103 132 169
        OFFSET 0 0
        OUTLINECOLOR 0 0 0
        WIDTH 0.91
      END # STYLE
    END # CLASS
	PROJECTION
		"init=epsg:27561"
	END
  END # LAYER

END # MAP/

And the corresponding PHP file :
/$map = ms_newMapObj("./toto.map");

if($_REQUEST["type_fichier"] == "kmz")
{
	$map->selectOutputFormat("kmz");
}
else if($_REQUEST["type_fichier"] == "shp")
{
	$map->selectOutputFormat("SHAPEZIP");
}
else if($_REQUEST["type_fichier"] == "dxf")
{
	$map->selectOutputFormat("DXF");
}
else if($_REQUEST["type_fichier"] == "midmif")
{
	$map->selectOutputFormat("MIDMIF");
}
else if($_REQUEST["type_fichier"] == "csv")
{
	$map->selectOutputFormat("CSV");
}

try
{
	$image = $map->draw();
	
	if($image != NULL)
	{
		$image_url = $image->saveWebImage();
		echo "ok<br>". $image_url;
	}
	else
	{
		echo "pasok<br>";
		
		$error = ms_GetErrorObj();
		while($error && $error->code != MS_NOERR)
		{
			echo $error->routine." : ".$error->message."<br>";
			$error = $error->next();
		}
	}
}
catch(Exception $e)
{
	echo "pasok<br>";
	echo $e->getMessage()."<br>";
	
	$error = ms_GetErrorObj();
	while($error && $error->code != MS_NOERR)
	{
		echo $error->routine." : ".$error->message."<br>";
		$error = $error->next();
	}
}/




--
View this message in context: http://osgeo-org.1560.x6.nabble.com/MapServer-6-4-1-OGR-output-error-tp5172655.html
Sent from the Mapserver - User mailing list archive at Nabble.com.



More information about the MapServer-users mailing list