[mapserver-users] DXF layer definition in mapfile

Frank Warmerdam warmerdam at pobox.com
Thu Mar 4 11:06:50 EST 2010


Dejan Gambin wrote:
> Hi,
> 
> Since DXF driver has been made, I would like to show a DXF file on the map. Is this possible? What syntax do I have to use to make it work?
> 
> I have tried defining it similar to dgn syntax, but it doesn't work. I get: "msOGRFileOpen(): Open failed for OGR connection in layer `layer_name'.  File not found or unsupported format.". 
> 
> ogrinfo works fine on this file. For example:
...
> My layer definition looks like this:
> 
> LAYER # dxf
>   NAME         "layer_name"
>   GROUP 	   "group_name"
>   STATUS       ON
>   TYPE         LINE
>   METADATA 
>     "DESCRIPTION" "Description"
>   END
>   CONNECTIONTYPE OGR
>   CONNECTION "/Library/WebServer/Documents/demodata/test.dxf"
>   DATA "0"
>   STYLEITEM "AUTO"
>   CLASS
>     NAME "All"
>   END
>   PROJECTION
>     "init=epsg:31275"
>   END
> END 

Dejan,

I suspect you have more than one gdal/ogr on your system and MapServer
isn't using the new one.  Because DXF files are represented as having only
one layer you don't normally need a DATA statement to select the layer.
One example of mine looks like:

MAP

STATUS ON
EXTENT 0 80 120 160
SIZE 600 400
FONTSET "/home/warmerda/mapserver/fonts.lst"
IMAGECOLOR 0 0 128

IMAGETYPE png

LAYER
   NAME shppoly
   TYPE line
   CONNECTIONTYPE OGR
   CONNECTION "assorted.dxf"
   STATUS default
   STYLEITEM "AUTO"
   CLASS
     NAME "work"
   END
END

LAYER
   NAME textstuff
   TYPE annotation
   CONNECTIONTYPE OGR
   CONNECTION "assorted.dxf"
   STATUS default
   STYLEITEM "AUTO"
   CLASS
     NAME "work"
   END
END

END


-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the mapserver-users mailing list