Opened 15 years ago

Closed 15 years ago

#35 closed defect (fixed)

Better handle datum_params when definition has no towgs84

Reported by: dgrichard Owned by: madair
Priority: major Milestone: 1.0.1
Component: core Version: 1.0.0
Keywords: Cc:

Description

I might be wrong, but PROJ4JS raises an exception when using a CRS that has no towgs84. For instance,

var p= new Proj4js.Proj('EPSG:4267');

raises :

datumDef.towgs84 has no properties

Seems that the deriveConstants() method does not check if towgs84 exists :

...
        if (datumDef) {
          this.datum_params = datumDef.towgs84.split(',');
...

in this case, datumDef (NAD27) has no towgs84 field. The key issue here is what to do ?

...
        if (datumDef) {
          this.datum_params = datumDef.towgs84?
              datumDef.towgs84.split(',')
          :   [0,0,0];
...

or

        if (datumDef) {
          try {
              this.datum_params = datumDef.towgs84.split(',');
          } catch (e) {
              throw "No towgs84 found for "+this.datumCode;
          }
...


The first alternative does not prevent to use (and may be wrongly reproject) the CRS, while the second prevents using the CRS.

Any idea ?

Change History (1)

comment:1 by madair, 15 years ago

Milestone: 1.0.01.0.1
Resolution: fixed
Status: newclosed
Version: 1.0.0

fixed at r1680 set datum parms to null to prevent a datum transform

Note: See TracTickets for help on using tickets.