-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathos_coord_transform.h
63 lines (52 loc) · 2.06 KB
/
os_coord_transform.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
/**
* OS Coord: A Simple OS Coordinate Transformation Library for C
*
* This is a port of a the Javascript library produced by Chris Veness available
* from http://www.movable-type.co.uk/scripts/latlong-gridref.html.
*
* These functions are largely based on the guide in "A guide to coordinate
* systems in Great Britain", Section 6 and Appendix C.
*/
#ifndef OS_COORD_TRANSFORM_H
#define OS_COORD_TRANSFORM_H
#include "os_coord.h"
/**
* Conversion from cartesian to lat-lon coordinates is done via an iterative
* algorithm. This constant defines the number of meters precision to achieve.
*/
#define OS_CART_TO_LAT_LON_PRECISION 4.0
/**
* Conversion from cartesian to eastings and northings on a TM projection to
* lat-lon is done via an iterative algorithm. This constant defines maximum
* value that (N - N_0 - M) may hold (m). The value 0.1mm is suggested by "A
* guide to coordinate systems in Great Britain".
*/
#define OS_EAS_NOR_TO_LAT_LON_PRECISION 0.00001
/**
* Convert a lat/lon/eh point on an ellipsoid to the corresponding point in 3D
* cartesian space.
*/
os_cartesian_t os_lat_lon_to_cartesian(os_lat_lon_t point, os_ellipsoid_t ellipsoid);
/**
* Convert a 3D cartesian point into a lat/lon/eh point on an ellipsoid.
*/
os_lat_lon_t os_cartesian_to_lat_lon(os_cartesian_t point, os_ellipsoid_t ellipsoid);
/**
* Transform a set of Helmert parameters to give the inverse transform.
*/
os_helmert_t os_helmert_invert(os_helmert_t helmert);
/**
* Perform a Helmert transform on a point in cartesian space.
*/
os_cartesian_t os_helmert_transform(os_cartesian_t point, os_helmert_t helmert);
/**
* Transform a lat/lon/eh into eastings and northings using a transverse
* mercator projection. Ellipsoidal height is copied verbatim.
*/
os_eas_nor_t os_lat_lon_to_tm_eas_nor(os_lat_lon_t point, os_tm_projection_t projection);
/**
* Transform a set of eastings and northings into lat/lon/eh from a transverse
* mercator projection. Height is copied verbatim.
*/
os_lat_lon_t os_tm_eas_nor_to_lat_lon(os_eas_nor_t point, os_tm_projection_t projection);
#endif