]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/geometry/srs/projections/impl/pj_datums.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / geometry / srs / projections / impl / pj_datums.hpp
CommitLineData
11fdf7f2
TL
1// Boost.Geometry (aka GGL, Generic Geometry Library)
2// This file is manually converted from PROJ4
3
4// Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
5
92f5a8d4
TL
6// This file was modified by Oracle on 2017, 2018.
7// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
11fdf7f2
TL
8// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
9
10// Use, modification and distribution is subject to the Boost Software License,
11// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
12// http://www.boost.org/LICENSE_1_0.txt)
13
14// This file is converted from PROJ4, http://trac.osgeo.org/proj
15// PROJ4 is originally written by Gerald Evenden (then of the USGS)
16// PROJ4 is maintained by Frank Warmerdam
17// PROJ4 is converted to Geometry Library by Barend Gehrels (Geodan, Amsterdam)
18
19// Original copyright notice:
20
21// Permission is hereby granted, free of charge, to any person obtaining a
22// copy of this software and associated documentation files (the "Software"),
23// to deal in the Software without restriction, including without limitation
24// the rights to use, copy, modify, merge, publish, distribute, sublicense,
25// and/or sell copies of the Software, and to permit persons to whom the
26// Software is furnished to do so, subject to the following conditions:
27
28// The above copyright notice and this permission notice shall be included
29// in all copies or substantial portions of the Software.
30
31// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
32// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
34// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
36// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
37// DEALINGS IN THE SOFTWARE.
38
39#ifndef BOOST_GEOMETRY_PROJECTIONS_IMPL_PJ_DATUMS_HPP
40#define BOOST_GEOMETRY_PROJECTIONS_IMPL_PJ_DATUMS_HPP
41
92f5a8d4
TL
42#include <boost/geometry/srs/projections/par_data.hpp>
43#include <boost/geometry/srs/projections/dpar.hpp>
44
45#include <string>
11fdf7f2
TL
46
47namespace boost { namespace geometry { namespace projections {
48
49namespace detail {
50
92f5a8d4
TL
51// Originally defined in projects.h
52template <typename T>
53struct pj_datums_type
54{
55 std::string id; /* datum keyword */
56 //std::string defn_n; /* e.g. "to_wgs84" */
57 //std::string defn_v; /* e.g. "0,0,0" */
58 //std::string ellipse_id; /* ie from ellipse table */
59 //std::string comments; /* EPSG code, etc */
60 srs::detail::nadgrids nadgrids;
61 srs::detail::towgs84<T> towgs84;
62 srs::dpar::value_ellps ellps;
63};
64
65// Originally defined in projects.h
66struct pj_prime_meridians_type
67{
68 std::string id; /* prime meridian keyword */
69 //std::string defn; /* offset from greenwich in DMS format. */
70 double deg;
71};
72
73inline double dms2d(double d, double m, double s, bool east)
74{
75 return (east ? 1 : -1) * (d + m / 60.0 + s / 3600.0);
76}
77
11fdf7f2
TL
78/*
79 * The ellipse code must match one from pj_ellps.c. The datum id should
80 * be kept to 12 characters or less if possible. Use the official OGC
81 * datum name for the comments if available.
82 */
83
92f5a8d4
TL
84template <typename T>
85inline std::pair<const pj_datums_type<T>*, int> pj_get_datums()
11fdf7f2 86{
92f5a8d4
TL
87 static const pj_datums_type<T> pj_datums[] =
88 {
89 {"WGS84", //"towgs84", "0,0,0",
90 //"WGS84", "",
91 srs::detail::nadgrids(),
92 srs::detail::towgs84<T>(0,0,0),
93 srs::dpar::ellps_wgs84},
94
95 {"GGRS87", //"towgs84", "-199.87,74.79,246.62",
96 //"GRS80", "Greek_Geodetic_Reference_System_1987",
97 srs::detail::nadgrids(),
98 srs::detail::towgs84<T>(-199.87,74.79,246.62),
99 srs::dpar::ellps_grs80},
100
101 {"NAD83", //"towgs84", "0,0,0",
102 //"GRS80", "North_American_Datum_1983",
103 srs::detail::nadgrids(),
104 srs::detail::towgs84<T>(0,0,0),
105 srs::dpar::ellps_grs80},
106
107 {"NAD27", //"nadgrids", "@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",
108 //"clrk66", "North_American_Datum_1927",
109 srs::detail::nadgrids("@conus","@alaska","@ntv2_0.gsb","@ntv1_can.dat"),
110 srs::detail::towgs84<T>(),
111 srs::dpar::ellps_clrk66},
112
113 {"potsdam", //"towgs84", "598.1,73.7,418.2,0.202,0.045,-2.455,6.7",
114 //"bessel", "Potsdam Rauenberg 1950 DHDN",
115 srs::detail::nadgrids(),
116 srs::detail::towgs84<T>(598.1,73.7,418.2,0.202,0.045,-2.455,6.7),
117 srs::dpar::ellps_bessel},
118
119 {"carthage", //"towgs84", "-263.0,6.0,431.0",
120 //"clrk80ign", "Carthage 1934 Tunisia",
121 srs::detail::nadgrids(),
122 srs::detail::towgs84<T>(-263.0,6.0,431.0),
123 srs::dpar::ellps_clrk80ign},
124
125 {"hermannskogel", //"towgs84", "577.326,90.129,463.919,5.137,1.474,5.297,2.4232",
126 //"bessel", "Hermannskogel",
127 srs::detail::nadgrids(),
128 srs::detail::towgs84<T>(577.326,90.129,463.919,5.137,1.474,5.297,2.4232),
129 srs::dpar::ellps_bessel},
130
131 {"ire65", //"towgs84", "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",
132 //"mod_airy", "Ireland 1965",
133 srs::detail::nadgrids(),
134 srs::detail::towgs84<T>(482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15),
135 srs::dpar::ellps_mod_airy},
136
137 {"nzgd49", //"towgs84", "59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",
138 //"intl", "New Zealand Geodetic Datum 1949",
139 srs::detail::nadgrids(),
140 srs::detail::towgs84<T>(59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993),
141 srs::dpar::ellps_intl},
142
143 {"OSGB36", //"towgs84", "446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",
144 //"airy", "Airy 1830",
145 srs::detail::nadgrids(),
146 srs::detail::towgs84<T>(446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894),
147 srs::dpar::ellps_airy}
148 };
149
150 return std::make_pair(pj_datums, (int)(sizeof(pj_datums) / sizeof(pj_datums[0])));
151}
152
153static const pj_prime_meridians_type pj_prime_meridians[] =
11fdf7f2
TL
154{
155 /* id definition */
156 /* -- ---------- */
92f5a8d4
TL
157 { "greenwich", /*"0dE",*/ 0 },
158 { "lisbon", /*"9d07'54.862\"W",*/ dms2d( 9, 7,54.862,false) },
159 { "paris", /*"2d20'14.025\"E",*/ dms2d( 2,20,14.025,true) },
160 { "bogota", /*"74d04'51.3\"W",*/ dms2d( 74, 4,51.3, false) },
161 { "madrid", /*"3d41'16.58\"W",*/ dms2d( 3,41,16.58, false) },
162 { "rome", /*"12d27'8.4\"E",*/ dms2d( 12,27, 8.4, true) },
163 { "bern", /*"7d26'22.5\"E",*/ dms2d( 7,26,22.5, true) },
164 { "jakarta", /*"106d48'27.79\"E",*/ dms2d(106,48,27.79, true) },
165 { "ferro", /*"17d40'W",*/ dms2d( 17,40, 0, false) },
166 { "brussels", /*"4d22'4.71\"E",*/ dms2d( 4,22,4.71, true) },
167 { "stockholm", /*"18d3'29.8\"E",*/ dms2d( 18, 3,29.8, true) },
168 { "athens", /*"23d42'58.815\"E",*/ dms2d( 23,42,58.815,true) },
169 { "oslo", /*"10d43'22.5\"E",*/ dms2d( 10,43,22.5, true) }
11fdf7f2
TL
170};
171
172} // namespace detail
173}}} // namespace boost::geometry::projections
174
175#endif // BOOST_GEOMETRY_PROJECTIONS_IMPL_PJ_DATUMS_HPP