Opened 14 years ago

Closed 14 years ago

#3643 closed defect (fixed)

Patch needed for dfInDegrees due to FactorB content of unit_of_measure.csv

Reported by: johncz711 Owned by: warmerdam
Priority: normal Milestone: 1.8.0
Component: OGR_SRS Version: 1.7.2
Severity: normal Keywords:
Cc:

Description

Within the EPSGGetUOMAngleInfo function, dfInDegrees is calculated as not-exactly 1.0 due to lack of precision in FactorB in the unit_of_measure.csv table. The imprecise dfInDegrees plays through the system to produce inexact values for projection parameters expressed in degrees.

This may be resolved by adding a patch for degree similar to the existing patch for grad. The lines which currently (1.7.2) read:

/* We do a special override of some of the DMS formats name */

if( nUOMAngleCode == 9102
nUOMAngleCode == 9107
nUOMAngleCode == 9108 nUOMAngleCode == 9110
nUOMAngleCode == 9122 )

pszUOMName = "degree";

can be changed to read:

/* We do a special override of some of the DMS formats name */

if( nUOMAngleCode == 9102
nUOMAngleCode == 9107
nUOMAngleCode == 9108 nUOMAngleCode == 9110
nUOMAngleCode == 9122 )

{

pszUOMName = "degree";

/* Lack of precision in FactorB causes apparent roundoff */

/* error for degree, so set it exactly here. */

dfInDegrees = 1.0;

}

A suitably modified copy of ogr_fromepsg.cpp is in the attached zip.

I have successfully used this suggested fix in a subset of OGR code recently added to my (non-ESRI-based) platform for the sole purpose of creating WKT and writing it as .prj files.

Attachments (1)

MOD_ogr_fromepsg.zip (15.0 KB ) - added by johncz711 14 years ago.

Download all attachments as: .zip

Change History (2)

by johncz711, 14 years ago

Attachment: MOD_ogr_fromepsg.zip added

comment:1 by Even Rouault, 14 years ago

Milestone: 1.8.0
Resolution: fixed
Status: newclosed

Fixed (a bit differently from the suggested patch) in r20495. Tests adjusted in r20496

Note: See TracTickets for help on using tickets.