Opened 13 years ago

Closed 5 years ago

#4182 closed enhancement (wontfix)

OGR writes dxf with English units

Reported by: craigleat Owned by: warmerdam
Priority: normal Milestone: closed_because_of_github_migration
Component: default Version: svn-trunk
Severity: normal Keywords: dxf
Cc:

Description

The dxf driver assumes English units when writing a file. I found the following in my dxf:

$MEASUREMENT

70

0

9

$INSUNITS

70

1

9


From the autodesk dxf reference:
$MEASUREMENT 70 Sets drawing units: 0 = English; 1 = Metric
$INSUNITS 70 Default drawing units for AutoCAD DesignCenter blocks: 0 = Unitless; 1 = Inches; 2 = Feet; 3 = Miles; 4 = Millimeters; etc

I don't live in North America. Suitable layer creation options would be useful.

Change History (7)

comment:1 by Alister, 11 years ago

Suitable layer creation options would be useful.

Wouldn't it be better to set it automatically based on the coordinate system?

Anyway, there would be an awful lot of people who only ever use metric measurements, in which case they should edit their $GDAL_DATA/header.dxf file. And unless there is movement on a fix in code, perhaps this should be mentioned in the documentation for the dxf driver.

comment:2 by Jukka Rahkonen, 9 years ago

I can edit the documentation. Alister, it would help me if you could suggest the exact text to add into http://www.gdal.org/drv_dxf.html.

comment:3 by Alister, 9 years ago

Hi, I think under "Creation Issues" add a new section called "Units of Measurement", saying this:

A common problem is that DXF files are produced which claim to be measured in inches, even though the coordinates are really in metres. This can be solved by editing the template file header.dxf (typically found as /usr/share/gdal/header.dxf or C:\OSGeo4W\share\gdal\header.dxf). Edit gdal.dxf in a text editor which can understand unix line endings (on Windows try wordpad rather than notepad), changing this section:

$MEASUREMENT

70

0

9

to this:

$MEASUREMENT

70

1

9

and this section:

$INSUNITS

70

1

9

to this:

$INSUNITS

70

6

9

DXF files which have already been created can be edited in the same manner.

comment:4 by Alister, 9 years ago

Although that seems more like tutorial content than a man page. And maybe a simpler solution would be to ship a "metric" and an "imperial" header.dxf.

comment:5 by Alister, 9 years ago

I guess if the user can't edit the system header.dxf they need to be pointed to the HEADER= option as well.

comment:6 by Jukka Rahkonen, 9 years ago

I added a new creation issue item about English units and added links to DXF specification and direct link to DXF header section codes and tried to clarify where to find the header.dxf file with r28369. Feel free to suggest more improvements. I agree that a longer tutorial suits better to wiki.

comment:7 by Even Rouault, 5 years ago

Milestone: closed_because_of_github_migration
Resolution: wontfix
Status: newclosed

This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.

Note: See TracTickets for help on using tickets.