Skip to content
Prev 1026 / 29559 Next

Importing and Handling DXF Map files in R

No know GRASS or wanting to struggle with getting it onto my (ugh!) windows
machine--the old terminal emulation bugaboo--I tackled this problem in a low
tech manner by running my dxf (ascii!) thru DXF2XYZ. Info on DXF2XYZ can now be
found at 

http://www.brightergraphics.co.uk/guthrie/dxf2xyz.htm

I do not know if this is new code or a modernization of the old (US) BLM code
dxf2xyz.c for DOS. But it does the job nicely.

Quoting the developers:

"DXF2XYZ 2.0 converts a DXF file to an XYZ file, ie a comma delimited text file
containing just xyz coordinates.

It can be useful for extracting the raw XYZ coordinates from a DXF file
containing say contours or other elevation entities.

...

(1) This utility is under development, and capabilities are fairly limited, but
will improve with time. The current version will extract the XYZ coordinates
from the following DXF entity types:
POINT, LINE, POLYLINE / VERTEX, LWPOLYLINE

(2) Although the software is not officially supported, you are welcome to
direct any queries/suggestions to Paul Guthrie pguthrie at guthcad.com.au "

So it does not get everything but you do get the map. I all found that had to
do a little post processing of the DXF2XYZ output to get polygons to close up
in R. Its been a couple of years but, if I remember right, the DXF2XYZ output
numbers the entities its translates. So I just read thru the output lines by
line checking the and by entity and if an entity needed closing up I did so by
adding another line segment connecting the last point with the first point. 

I can not remember if I did this in R, BASIC, or FORTRAN but it was
straight-forward.

It has worked very nicely.

HTH

Regards,
Michael Grant

PS Then there is the time I just went looking for points in a dxf...cut and
paste the whole thing into EXCEL, sorted, ... I can't remember why I had to do
it that way... it was a horrible experience :O).
--- Francisco Javier Aguirre Navarro <FAGUIRRN at grupobavaria.com> wrote: