Ticket #40 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

bug in inverse in pj_sts.c

Reported by: barendgehrels Owned by: warmerdam
Priority: major Milestone: 4.7.0
Component: Core Version: unspecified
Keywords: sts kav5 Cc:

Description

The inverse projection in file PJ_sts.c gives wrong results.

Line 34, lp.phi /= P->C_p; should be erased because is duplicated in line 35. This is already solved in libproj4

Change History

follow-up: ↓ 2   Changed 4 years ago by warmerdam

  • keywords sts added
  • status changed from new to assigned
  • component changed from default to Core
  • milestone set to 4.7.0

I have attempted to do the same thing slightly differently by removing the second operation (as a side effect inside another expression - ouch!) The change is in trunk (r1578). I'd appreciate confirmation that this is appropriate and test data for this projection that I could add to the test suite.

in reply to: ↑ 1   Changed 4 years ago by barendgehrels

I can confirm that the change is correct.

The "side effect" is also present in the line above. Actually they are a weird thing in C, embraced by some, rejected by others, and present in many more proj4 sources. I don't know if you want to stay close to the original or branched versions, or that you want to refactor these constructs (making ports to other languages easier).

Where is the test suite?

  Changed 4 years ago by warmerdam

It is my wish to make minimal changes in the hopes that eventual merging with Gerald's fork will be easier. There is a modest test suite in the proj/nad directory (rather counter intuitive location I know!).

See proj/nad/testvarious

It is sufficient however if you can provide input, expected output and the coordinate system.

  Changed 4 years ago by barendgehrels

OK, I'm not familiar with those kinds of tests so limit myself indeed to the input/output:

(string, lon, lat, x, y, pars)

forward: ("kav5", 4.897000, 52.371000, 383646.088858, 5997047.888175, "+proj=kav5 +ellps=WGS84 +units=m");

(string, x, y, lon, lat, pars)

inverse: ("kav5", 383646.088858, 5997047.888175, 4.897000, 52.371000, "+proj=kav5 +ellps=WGS84 +units=m");

These x,y are not "the expected values", they are the proj4-calculated-values. However, when applying then the inverse you might expect to get back a lon,lat pair which is close to the original input and that is what I checked.

If wished I can provide a proj4 testfile-in-C "checking" (in this way) all projections (I have it, with slight adaptions it is probably convenient).

Most projections are doing well, some have a difference of a few meters or kilometer, one of them is wrong (I contacted Gerald), one is still to be checked further.

  Changed 4 years ago by warmerdam

  • keywords kav5 added
  • status changed from assigned to closed
  • resolution set to fixed

I have added in this test for kav5 in trunk along with a bit of restructuring (r1579).

Note: See TracTickets for help on using tickets.