1 // Boost.Geometry
2 // Unit Test
3
4 // Copyright (c) 2017-2018, Oracle and/or its affiliates.
5 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
6
7 // Use, modification and distribution is subject to the Boost Software License,
8 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
10
11
12 #include <geometry_test_common.hpp>
13
14 #include <boost/geometry.hpp>
15 #include <boost/geometry/geometries/geometries.hpp>
16 #include <boost/geometry/srs/epsg.hpp>
17 #include <boost/geometry/srs/esri.hpp>
18 #include <boost/geometry/srs/iau2000.hpp>
19 #include <boost/geometry/srs/projection.hpp>
20
21 #include "check_geometry.hpp"
22
test_main(int,char * [])23 int test_main(int, char*[])
24 {
25 using namespace boost::geometry;
26 using namespace boost::geometry::model;
27 using namespace boost::geometry::srs;
28
29 typedef point<double, 2, cs::geographic<degree> > point_ll;
30 typedef point<double, 2, cs::cartesian> point_xy;
31
32 {
33 point_ll pt_ll(1, 1);
34 point_ll pt_ll2(0, 0);
35 point_xy pt_xy(0, 0);
36
37 projection<> prj = epsg(2000);
38
39 prj.forward(pt_ll, pt_xy);
40 test::check_geometry(pt_xy, "POINT(9413505.3284665551 237337.74515944949)", 0.001);
41
42 prj.inverse(pt_xy, pt_ll2);
43 // TODO: investigate this wierd result
44 test::check_geometry(pt_ll2, "POINT(-2.4463131191981073 1.5066638962045082)", 0.001);
45
46 projection<> prj2 = esri(37001);
47 projection<> prj3 = iau2000(19900);
48 }
49
50 {
51 using namespace boost::geometry::srs::dpar;
52
53 point_ll pt_ll(1, 1);
54 point_ll pt_ll2(0, 0);
55 point_xy pt_xy(0, 0);
56
57 projection<> prj = parameters<>(proj_tmerc)(ellps_wgs84)(units_m);
58
59 prj.forward(pt_ll, pt_xy);
60 test::check_geometry(pt_xy, "POINT(111308.33561309829 110591.34223734379)", 0.001);
61
62 prj.inverse(pt_xy, pt_ll2);
63 test::check_geometry(pt_ll2, "POINT(1 1)", 0.001);
64 }
65
66 return 0;
67 }
68