forked from php-geospatial/geospatial
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
php_geospatial.h
151 lines (131 loc) · 3.93 KB
/
php_geospatial.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2013 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| [email protected] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <[email protected]> |
| Michael Maclean <[email protected]> |
| Nathaniel McHugh <[email protected]> |
| Marcus Deglos <[email protected]> |
+----------------------------------------------------------------------+
*/
#ifndef PHP_GEOSPATIAL_H
#define PHP_GEOSPATIAL_H
extern zend_module_entry geospatial_module_entry;
#define phpext_geospatial_ptr &geospatial_module_entry
#ifdef PHP_WIN32
# define PHP_GEOSPATIAL_API __declspec(dllexport)
#elif defined(__GNUC__) && __GNUC__ >= 4
# define PHP_GEOSPATIAL_API __attribute__ ((visibility("default")))
#else
# define PHP_GEOSPATIAL_API
#endif
#ifdef ZTS
#include "TSRM.h"
#endif
typedef struct {
double latitude;
double longitude;
double height;
} geo_lat_long;
typedef struct {
double a;
double b;
double f;
} geo_ellipsoid;
typedef struct {
double x;
double y;
double z;
} geo_cartesian;
/**
* Structure of the seven variables used in the helmert transformation
*
*/
typedef struct {
double translation_x;
double translation_y;
double translation_z;
double scale_change;
double rotation_x;
double rotation_y;
double rotation_z;
} geo_helmert_constants;
/**
* The WGS84 elipsoid semi major axes
*/
const geo_ellipsoid wgs84 = {6378137.000, 6356752.3142, 1.0/298.257223563};
/**
* The Airy 1830 elipsoid semi major axes
*/
const geo_ellipsoid airy_1830 = {6377563.396, 6356256.910, 1.0/299.3249646};
/**
* The GRS 80 elipsoid semi major axes
*/
const geo_ellipsoid grs80 = {6378137.000, 6356752.314140, 1.0/298.257222101};
/**
* The values of the 7 variables for performing helmert transformation between
* wgs84 and osgb36
*/
const geo_helmert_constants wgs84_osgb36 = {
-446.448,
125.157,
-542.060,
0.0000204894,
-0.1502,
-0.2470,
-0.8421
};
/**
* The values of the 7 variables for performing helmert transformation between
* osgb36 and wgs84 -1 * the values for the reverse transformation
*/
const geo_helmert_constants osgb36_wgs84 = {
446.448,
-125.157,
542.060,
-0.0000204894,
0.1502,
0.2470,
0.8421
};
#define GEO_DEG_TO_RAD 0.017453292519943295769236907684886
/**
* Calculate the radius using WGS-84's equatorial radius of
* 6,378,1370m
*/
#define GEO_EARTH_RADIUS 6378.137
#define GEO_SEC_IN_DEG 3600
#define GEO_WGS84 0x0001
#define GEO_AIRY_1830 0x0002
#define HEIGHT 24.7
PHP_MINIT_FUNCTION(geospatial);
PHP_MINFO_FUNCTION(geospatial);
PHP_FUNCTION(haversine);
PHP_FUNCTION(fraction_along_gc_line);
PHP_FUNCTION(helmert);
PHP_FUNCTION(polar_to_cartesian);
PHP_FUNCTION(cartesian_to_polar);
PHP_FUNCTION(transform_datum);
PHP_FUNCTION(dms_to_decimal);
PHP_FUNCTION(decimal_to_dms);
PHP_FUNCTION(vincenty);
PHP_FUNCTION(rdp_simplify);
#endif /* PHP_GEOSPATIAL_H */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/