27
27
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28
28
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29
29
* DEALINGS IN THE SOFTWARE.
30
******************************************************************************
32
* $Log: pj_transform.c,v $
33
* Revision 1.24 2007/12/03 15:48:20 fwarmerdam
34
* Improve WGS84 ES precision to avoid unnecesary transformation (#1531)
36
* Revision 1.23 2007/11/26 00:21:59 fwarmerdam
37
* Modified PJ structure to hold a_orig, es_orig, ellipsoid definition before
38
* adjustment for spherical projections.
39
* Modified pj_datum_transform() to use the original ellipsoid parameters,
40
* not the ones adjusted for spherical projections.
41
* Modified pj_datum_transform() to not attempt any datum shift via
42
* geocentric coordinates if the source *or* destination are raw ellipsoids
43
* (ie. PJD_UNKNOWN). All per PROJ bug #1602, GDAL bug #2025.
45
* Revision 1.22 2007/09/11 20:32:25 fwarmerdam
46
* mark the transient error array const
48
* Revision 1.21 2007/09/11 20:19:36 fwarmerdam
49
* avoid use of static variables to make reentrant
51
* Revision 1.20 2006/10/12 21:04:39 fwarmerdam
52
* Added experimental +lon_wrap argument to set a "center point" for
53
* longitude wrapping of longitude values coming out of pj_transform().
55
* Revision 1.19 2006/05/10 19:23:47 fwarmerdam
56
* Don't apply to_meter in pj_transform() if the value is HUGE_VAL.
58
* Revision 1.18 2006/05/01 21:13:54 fwarmerdam
59
* make out of range errors in geodetic to geocentric a transient error
61
* Revision 1.17 2006/03/20 17:54:34 fwarmerdam
62
* pj_geodetic_to_geocentric returns -14 now for lat out of range
64
* Revision 1.16 2006/02/17 02:26:14 fwarmerdam
65
* ERANGE/EDOM treated as transient errors
67
* Revision 1.15 2005/12/04 14:47:37 fwarmerdam
68
* use symbolic names as per patch from Martin Vermeer
70
* Revision 1.14 2004/11/05 06:05:11 fwarmerdam
71
* Fixed pj_geocentric_to_geodetic() to not try and process HUGE_VAL values
72
* (those that have failed some previous transform step). Related to bug:5B
73
* http://bugzilla.remotesensing.org/show_bug.cgi?id=642
75
* Revision 1.13 2004/10/25 15:34:36 fwarmerdam
76
* make names of geodetic funcs from geotrans unique
78
* Revision 1.12 2004/05/03 19:45:23 warmerda
79
* Altered so that raw ellpses are treated as a essentially having a
80
* +towgs84=0,0,0 specification so ellpisoid shifts are applied.
81
* Fixed so that prime meridian shifts are applied if the coordinate system is
82
* not lat/long (ie. if it is projected). This fixes:
83
* http://bugzilla.remotesensing.org/show_bug.cgi?id=510
85
* Revision 1.11 2004/01/24 09:37:19 warmerda
86
* pj_transform() will no longer return an error code if any of the points are
87
* transformable. In this case the application is expected to check for
88
* HUGE_VAL to identify failed points.
89
* As part of the implementation, I added a list of pj_errno values that
90
* are transient (ie per-point) rather than indicating global failure for the
91
* coordinate system definition. We use this in deciding which pj_fwd and
92
* pj_inv error codes are really fatal and should be reported.
94
* Revision 1.10 2003/08/21 02:09:06 warmerda
95
* added a bunch of HUGE_VAL checking
97
* Revision 1.9 2003/03/26 16:52:30 warmerda
98
* added check that an inverse transformation func exists
100
* Revision 1.8 2002/12/14 20:35:43 warmerda
101
* implement units support for geocentric coordinates
103
* Revision 1.7 2002/12/14 20:14:35 warmerda
104
* added geocentric support
106
* Revision 1.6 2002/12/09 16:01:02 warmerda
107
* added prime meridian support
109
* Revision 1.5 2002/12/01 19:25:26 warmerda
110
* applied fix for 7 param shift in pj_geocentric_from_wgs84, see bug 194
112
* Revision 1.4 2002/02/15 14:30:36 warmerda
113
* provide default Z array if none passed in in pj_datum_transform()
115
* Revision 1.3 2001/04/04 21:13:21 warmerda
116
* do arcsecond/radian and ppm datum parm transformation in pj_set_datum()
118
* Revision 1.2 2001/04/04 16:08:08 warmerda
119
* rewrote 7 param datum shift to match EPSG:9606, now works with example
121
* Revision 1.1 2000/07/06 23:32:27 warmerda
30
*****************************************************************************/
126
32
#include <projects.h>
127
33
#include <string.h>
129
35
#include "geocent.h"
131
PJ_CVSID("$Id: pj_transform.c,v 1.24 2007/12/03 15:48:20 fwarmerdam Exp $");
37
PJ_CVSID("$Id: pj_transform.c 1504 2009-01-06 02:11:57Z warmerdam $");
133
39
#ifndef SRS_WGS84_SEMIMAJOR
134
40
#define SRS_WGS84_SEMIMAJOR 6378137.0