Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:35:38

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 // This file is manually converted from PROJ4
0003 
0004 // Copyright (c) 2008-2012 Barend Gehrels, Amsterdam, the Netherlands.
0005 
0006 // This file was modified by Oracle on 2017, 2018.
0007 // Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
0008 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0009 
0010 // Use, modification and distribution is subject to the Boost Software License,
0011 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0012 // http://www.boost.org/LICENSE_1_0.txt)
0013 
0014 // This file is converted from PROJ4, http://trac.osgeo.org/proj
0015 // PROJ4 is originally written by Gerald Evenden (then of the USGS)
0016 // PROJ4 is maintained by Frank Warmerdam
0017 // PROJ4 is converted to Geometry Library by Barend Gehrels (Geodan, Amsterdam)
0018 
0019 // Original copyright notice:
0020 
0021 // Permission is hereby granted, free of charge, to any person obtaining a
0022 // copy of this software and associated documentation files (the "Software"),
0023 // to deal in the Software without restriction, including without limitation
0024 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
0025 // and/or sell copies of the Software, and to permit persons to whom the
0026 // Software is furnished to do so, subject to the following conditions:
0027 
0028 // The above copyright notice and this permission notice shall be included
0029 // in all copies or substantial portions of the Software.
0030 
0031 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
0032 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0033 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
0034 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
0035 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
0036 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
0037 // DEALINGS IN THE SOFTWARE.
0038 
0039 #ifndef BOOST_GEOMETRY_PROJECTIONS_IMPL_PJ_DATUMS_HPP
0040 #define BOOST_GEOMETRY_PROJECTIONS_IMPL_PJ_DATUMS_HPP
0041 
0042 #include <boost/geometry/srs/projections/par_data.hpp>
0043 #include <boost/geometry/srs/projections/dpar.hpp>
0044 
0045 #include <string>
0046 
0047 namespace boost { namespace geometry { namespace projections {
0048 
0049 namespace detail {
0050 
0051 // Originally defined in projects.h
0052 template <typename T>
0053 struct pj_datums_type
0054 {
0055     std::string id;         /* datum keyword */
0056     //std::string defn_n;     /* e.g. "to_wgs84" */
0057     //std::string defn_v;     /* e.g. "0,0,0" */
0058     //std::string ellipse_id; /* ie from ellipse table */
0059     //std::string comments;   /* EPSG code, etc */
0060     srs::detail::nadgrids nadgrids;
0061     srs::detail::towgs84<T> towgs84;
0062     srs::dpar::value_ellps ellps;
0063 };
0064 
0065 // Originally defined in projects.h
0066 struct pj_prime_meridians_type
0067 {
0068     std::string id;   /* prime meridian keyword */
0069     //std::string defn; /* offset from greenwich in DMS format. */
0070     double deg;
0071 };
0072 
0073 inline double dms2d(double d, double m, double s, bool east)
0074 {
0075     return (east ? 1 : -1) * (d + m / 60.0 + s / 3600.0);
0076 }
0077 
0078 /*
0079  * The ellipse code must match one from pj_ellps.c.  The datum id should
0080  * be kept to 12 characters or less if possible.  Use the official OGC
0081  * datum name for the comments if available.
0082  */
0083 
0084 template <typename T>
0085 inline std::pair<const pj_datums_type<T>*, int> pj_get_datums()
0086 {
0087     static const pj_datums_type<T> pj_datums[] =
0088     {
0089         {"WGS84",           //"towgs84",   "0,0,0",
0090                             //"WGS84",     "",
0091                             srs::detail::nadgrids(),
0092                             srs::detail::towgs84<T>(0,0,0),
0093                             srs::dpar::ellps_wgs84},
0094 
0095         {"GGRS87",          //"towgs84",   "-199.87,74.79,246.62",
0096                             //"GRS80",     "Greek_Geodetic_Reference_System_1987",
0097                             srs::detail::nadgrids(),
0098                             srs::detail::towgs84<T>(-199.87,74.79,246.62),
0099                             srs::dpar::ellps_grs80},
0100 
0101         {"NAD83",           //"towgs84",   "0,0,0",
0102                             //"GRS80",     "North_American_Datum_1983",
0103                             srs::detail::nadgrids(),
0104                             srs::detail::towgs84<T>(0,0,0),
0105                             srs::dpar::ellps_grs80},
0106 
0107         {"NAD27",           //"nadgrids",  "@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",
0108                             //"clrk66",    "North_American_Datum_1927",
0109                             srs::detail::nadgrids("@conus","@alaska","@ntv2_0.gsb","@ntv1_can.dat"),
0110                             srs::detail::towgs84<T>(),
0111                             srs::dpar::ellps_clrk66},
0112 
0113         {"potsdam",         //"towgs84",   "598.1,73.7,418.2,0.202,0.045,-2.455,6.7",
0114                             //"bessel",    "Potsdam Rauenberg 1950 DHDN",
0115                             srs::detail::nadgrids(),
0116                             srs::detail::towgs84<T>(598.1,73.7,418.2,0.202,0.045,-2.455,6.7),
0117                             srs::dpar::ellps_bessel},
0118 
0119         {"carthage",        //"towgs84",   "-263.0,6.0,431.0",
0120                             //"clrk80ign", "Carthage 1934 Tunisia",
0121                             srs::detail::nadgrids(),
0122                             srs::detail::towgs84<T>(-263.0,6.0,431.0),
0123                             srs::dpar::ellps_clrk80ign},
0124 
0125         {"hermannskogel",   //"towgs84",   "577.326,90.129,463.919,5.137,1.474,5.297,2.4232",
0126                             //"bessel",    "Hermannskogel",
0127                             srs::detail::nadgrids(),
0128                             srs::detail::towgs84<T>(577.326,90.129,463.919,5.137,1.474,5.297,2.4232),
0129                             srs::dpar::ellps_bessel},
0130 
0131         {"ire65",           //"towgs84",   "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",
0132                             //"mod_airy",  "Ireland 1965",
0133                             srs::detail::nadgrids(),
0134                             srs::detail::towgs84<T>(482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15),
0135                             srs::dpar::ellps_mod_airy},
0136 
0137         {"nzgd49",          //"towgs84",   "59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",
0138                             //"intl",      "New Zealand Geodetic Datum 1949",
0139                             srs::detail::nadgrids(),
0140                             srs::detail::towgs84<T>(59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993),
0141                             srs::dpar::ellps_intl},
0142 
0143         {"OSGB36",          //"towgs84",   "446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",
0144                             //"airy",      "Airy 1830",
0145                             srs::detail::nadgrids(),
0146                             srs::detail::towgs84<T>(446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894),
0147                             srs::dpar::ellps_airy}
0148     };
0149 
0150     return std::make_pair(pj_datums, (int)(sizeof(pj_datums) / sizeof(pj_datums[0])));
0151 }
0152 
0153 static const pj_prime_meridians_type pj_prime_meridians[] =
0154 {
0155     /* id          definition */
0156     /* --          ---------- */
0157     { "greenwich", /*"0dE",*/             0 },
0158     { "lisbon",    /*"9d07'54.862\"W",*/  dms2d(  9, 7,54.862,false) },
0159     { "paris",     /*"2d20'14.025\"E",*/  dms2d(  2,20,14.025,true) },
0160     { "bogota",    /*"74d04'51.3\"W",*/   dms2d( 74, 4,51.3,  false) },
0161     { "madrid",    /*"3d41'16.58\"W",*/   dms2d(  3,41,16.58, false) },
0162     { "rome",      /*"12d27'8.4\"E",*/    dms2d( 12,27, 8.4,  true) },
0163     { "bern",      /*"7d26'22.5\"E",*/    dms2d(  7,26,22.5,  true) },
0164     { "jakarta",   /*"106d48'27.79\"E",*/ dms2d(106,48,27.79, true) },
0165     { "ferro",     /*"17d40'W",*/         dms2d( 17,40, 0,    false) },
0166     { "brussels",  /*"4d22'4.71\"E",*/    dms2d(  4,22,4.71,  true) },
0167     { "stockholm", /*"18d3'29.8\"E",*/    dms2d( 18, 3,29.8,  true) },
0168     { "athens",    /*"23d42'58.815\"E",*/ dms2d( 23,42,58.815,true) },
0169     { "oslo",      /*"10d43'22.5\"E",*/   dms2d( 10,43,22.5,  true) }
0170 };
0171 
0172 } // namespace detail
0173 }}} // namespace boost::geometry::projections
0174 
0175 #endif // BOOST_GEOMETRY_PROJECTIONS_IMPL_PJ_DATUMS_HPP