[mapserver-users] DXF export issues

Bruno D bruno.domenget at rochservice.com
Wed May 13 02:46:10 PDT 2015


Hi all,

I'm trying to add an "Export to DXF" option to my online maps (using
MapServer, Mapscript PHP and WFS calls). I'm using OGR output, it works well
with other formats (SHP, MifMid, ...) but I got some issues with DXF :

*I can't find a way to get the labels to be created automatically.* The GDAL
doc says "Point features with LABEL styling are written as MTEXT entities
based on the styling information.". My point features do have a class with
label styling, so I suppose it should work. But it doesn't, I only get
points without labels.

*If I use "gml_include_items" "all" in the layer METADATA, I get the
following error : "DXF layer does not support arbitrary field creation" and
the DXF is corrupted.* The only item I can include seems to be "Layer".

Can anyone tell me what I am missing ?

I'm using MapServer 6.4.1 on a CentOS server.

/The PHP script I use to export the files :/
$req = new OWSRequestObj();

$args = Array("service" => "WFS", "request" => "GetFeature", "version" =>
"1.1.0", "typename" => "Objets");

foreach($args as $param => $value)
	$req->setParameter($param, $value);

$req->setParameter("outputformat",$type_sortie);

ms_ioinstallstdouttobuffer();
$map->owsDispatch($req);
ms_iostripstdoutbuffercontentheaders();
result = ms_iogetstdoutbufferstring();

/My mapfile :/
MAP
	NAME "Default"
	SIZE 1000 600
	STATUS ON
	SYMBOLSET "../fic/0 MAPSERVER/symbols.sym"
	EXTENT -10 40 9 51
	UNITS DD
	SHAPEPATH "../fic/0 MAPSERVER/shapefiles"

	PROJECTION
		"init=epsg:4326"
	END

	WEB
		METADATA
			"wms_title" "Map wms"
			"wms_onlineresource" "LINK_TO_SERVER"
			"wms_srs" "EPSG:4326"
			"wms_enable_request" "*"
			"ows_enable_request" "*" 
			"wfs_getfeature_formatlist" "dxf,midmif,shapezip,csv"
		END
	END # WEB

	OUTPUTFORMAT
		NAME "jpeg"
		DRIVER AGG/JPEG
		MIMETYPE "image/jpeg"
		IMAGEMODE RGB
		EXTENSION "jpg"
		FORMATOPTION "GAMMA=0.75"
	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=filesystem"
        FORMATOPTION "FORM=zip"
        FORMATOPTION "FILENAME=result_shp.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=simple"
        FORMATOPTION "FILENAME=result_dxf.dxf"
	END 

LAYER NAME "Objets"
	MAXSCALEDENOM 50000000
	TOLERANCE 0
	TOLERANCEUNITS pixels
	STATUS ON
	TEMPLATE "../template.html"
	PROCESSING "ITEMS=classe,idobjet,Layer"
	TILEITEM "location"
	TYPE POINT
	UNITS DD
	LABELITEM "TEXT"
	CLASSITEM "classe"
	
*METADATA
"ows_title"         "objets"
"ows_description"   "objets"
"wfs_featureid"     "idobjet"
"wfs_getfeature_formatlist" "dxf,midmif,shapezip,csv"
"gml_include_items" "all"
"gml_types"         "auto"
END*

	CLASS
		NAME "mat"
		EXPRESSION "mat"
		STYLE
			ANGLE 0
			OFFSET 0 0
			COLOR 0 0 0
			SIZE 12
			SYMBOL "mat"
		END # STYLE
		LABEL
			COLOR 0 0 0
			POSITION uc
			PARTIALS FALSE
			BUFFER 4
		END
	END # CLASS

	PROJECTION 
		"init=epsg:4326"
	END

	FEATURE
		ITEMS "mat;991474;Gropouic"
		TEXT "02SV2"
		POINTS
			2.3445457220077515 48.905171631164436
		END
	END

	FEATURE
		ITEMS "mat;760928;Gropouic"
		TEXT "03S"
		POINTS
			2.342459 48.908074
		END
	END

	FEATURE
		ITEMS "mat;760930;Gropouic"
		TEXT "05S"
		POINTS
			2.343017 48.907862
		END
	END

	FEATURE
		ITEMS "mat;760931;Gropouic2"
		TEXT "06S"
		POINTS
			2.343274 48.907737
		END
	END

	FEATURE
		ITEMS "mat;760933;Gropouic2"
		TEXT "08S"
		POINTS
			2.343777902 48.907541036
		END
	END

	FEATURE
		ITEMS "mat;760934;Gropouic2"
		TEXT "09S"
		POINTS
			2.343926 48.907478
		END
	END

END # LAYER

END # MAP



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/DXF-export-issues-tp5205533.html
Sent from the Mapserver - User mailing list archive at Nabble.com.



More information about the MapServer-users mailing list