rgeo 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +29 -0
- data/ext/geos_c_impl/Makefile_2.2.3 +260 -0
- data/ext/geos_c_impl/coordinates.c +65 -0
- data/ext/geos_c_impl/coordinates.h +2 -0
- data/ext/geos_c_impl/extconf.rb +19 -43
- data/ext/geos_c_impl/geometry.c +24 -0
- data/ext/geos_c_impl/geometry_collection.c +99 -1
- data/ext/geos_c_impl/geos_c_impl_2.2.3.bundle +0 -0
- data/ext/geos_c_impl/line_string.c +38 -0
- data/ext/geos_c_impl/mkmf.log +123 -0
- data/ext/geos_c_impl/point.c +27 -0
- data/ext/geos_c_impl/polygon.c +26 -0
- data/ext/proj4_c_impl/Makefile_2.2.3 +260 -0
- data/ext/proj4_c_impl/extconf.rb +32 -32
- data/ext/proj4_c_impl/mkmf.log +47 -0
- data/ext/proj4_c_impl/proj4_c_impl_2.2.3.bundle +0 -0
- data/lib/rgeo.rb +10 -11
- data/lib/rgeo/cartesian.rb +7 -12
- data/lib/rgeo/cartesian/analysis.rb +13 -26
- data/lib/rgeo/cartesian/bounding_box.rb +45 -114
- data/lib/rgeo/cartesian/calculations.rb +3 -21
- data/lib/rgeo/cartesian/factory.rb +101 -122
- data/lib/rgeo/cartesian/feature_classes.rb +9 -59
- data/lib/rgeo/cartesian/feature_methods.rb +15 -45
- data/lib/rgeo/cartesian/interface.rb +6 -17
- data/lib/rgeo/coord_sys.rb +9 -15
- data/lib/rgeo/coord_sys/cs/entities.rb +84 -330
- data/lib/rgeo/coord_sys/cs/factories.rb +2 -32
- data/lib/rgeo/coord_sys/cs/wkt_parser.rb +52 -80
- data/lib/rgeo/coord_sys/proj4.rb +28 -67
- data/lib/rgeo/coord_sys/proj4_c_impl.bundle +0 -0
- data/lib/rgeo/coord_sys/srs_database/interface.rb +4 -24
- data/lib/rgeo/coord_sys/srs_database/proj4_data.rb +20 -38
- data/lib/rgeo/coord_sys/srs_database/sr_org.rb +6 -22
- data/lib/rgeo/coord_sys/srs_database/url_reader.rb +6 -21
- data/lib/rgeo/error.rb +0 -6
- data/lib/rgeo/feature.rb +18 -23
- data/lib/rgeo/feature/curve.rb +0 -14
- data/lib/rgeo/feature/factory.rb +13 -38
- data/lib/rgeo/feature/factory_generator.rb +4 -16
- data/lib/rgeo/feature/geometry.rb +18 -60
- data/lib/rgeo/feature/geometry_collection.rb +3 -17
- data/lib/rgeo/feature/line.rb +0 -10
- data/lib/rgeo/feature/line_string.rb +1 -13
- data/lib/rgeo/feature/linear_ring.rb +0 -9
- data/lib/rgeo/feature/mixins.rb +11 -36
- data/lib/rgeo/feature/multi_curve.rb +0 -11
- data/lib/rgeo/feature/multi_line_string.rb +0 -9
- data/lib/rgeo/feature/multi_point.rb +0 -9
- data/lib/rgeo/feature/multi_polygon.rb +0 -9
- data/lib/rgeo/feature/multi_surface.rb +0 -12
- data/lib/rgeo/feature/point.rb +0 -13
- data/lib/rgeo/feature/polygon.rb +1 -14
- data/lib/rgeo/feature/surface.rb +0 -12
- data/lib/rgeo/feature/types.rb +19 -61
- data/lib/rgeo/geographic.rb +10 -15
- data/lib/rgeo/geographic/factory.rb +126 -147
- data/lib/rgeo/geographic/interface.rb +67 -81
- data/lib/rgeo/geographic/proj4_projector.rb +13 -37
- data/lib/rgeo/geographic/projected_feature_classes.rb +7 -66
- data/lib/rgeo/geographic/projected_feature_methods.rb +15 -80
- data/lib/rgeo/geographic/projected_window.rb +15 -67
- data/lib/rgeo/geographic/simple_mercator_projector.rb +32 -56
- data/lib/rgeo/geographic/spherical_feature_classes.rb +9 -68
- data/lib/rgeo/geographic/spherical_feature_methods.rb +18 -51
- data/lib/rgeo/geographic/spherical_math.rb +26 -51
- data/lib/rgeo/geos.rb +23 -20
- data/lib/rgeo/geos/capi_factory.rb +125 -131
- data/lib/rgeo/geos/capi_feature_classes.rb +21 -88
- data/lib/rgeo/geos/ffi_factory.rb +90 -143
- data/lib/rgeo/geos/ffi_feature_classes.rb +8 -63
- data/lib/rgeo/geos/ffi_feature_methods.rb +46 -162
- data/lib/rgeo/geos/geos_c_impl.bundle +0 -0
- data/lib/rgeo/geos/interface.rb +4 -23
- data/lib/rgeo/geos/utils.rb +4 -19
- data/lib/rgeo/geos/zm_factory.rb +82 -131
- data/lib/rgeo/geos/zm_feature_classes.rb +8 -63
- data/lib/rgeo/geos/zm_feature_methods.rb +34 -107
- data/lib/rgeo/impl_helper.rb +8 -13
- data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +27 -71
- data/lib/rgeo/impl_helper/basic_geometry_methods.rb +10 -28
- data/lib/rgeo/impl_helper/basic_line_string_methods.rb +21 -57
- data/lib/rgeo/impl_helper/basic_point_methods.rb +12 -30
- data/lib/rgeo/impl_helper/basic_polygon_methods.rb +9 -28
- data/lib/rgeo/impl_helper/math.rb +4 -10
- data/lib/rgeo/impl_helper/utils.rb +2 -10
- data/lib/rgeo/version.rb +1 -1
- data/lib/rgeo/wkrep.rb +4 -9
- data/lib/rgeo/wkrep/wkb_generator.rb +22 -46
- data/lib/rgeo/wkrep/wkb_parser.rb +25 -52
- data/lib/rgeo/wkrep/wkt_generator.rb +39 -69
- data/lib/rgeo/wkrep/wkt_parser.rb +52 -89
- data/lib/rgeo/yaml.rb +1 -7
- data/test/common/factory_tests.rb +4 -19
- data/test/common/geometry_collection_tests.rb +6 -39
- data/test/common/line_string_tests.rb +10 -39
- data/test/common/multi_line_string_tests.rb +10 -30
- data/test/common/multi_point_tests.rb +15 -34
- data/test/common/multi_polygon_tests.rb +26 -28
- data/test/common/point_tests.rb +37 -59
- data/test/common/polygon_tests.rb +16 -25
- data/test/coord_sys/tc_ogc_cs.rb +151 -186
- data/test/coord_sys/tc_proj4.rb +35 -60
- data/test/coord_sys/tc_proj4_srs_data.rb +15 -24
- data/test/coord_sys/tc_sr_org.rb +11 -19
- data/test/coord_sys/tc_url_reader.rb +13 -23
- data/test/geos_capi/tc_factory.rb +7 -16
- data/test/geos_capi/tc_geometry_collection.rb +6 -14
- data/test/geos_capi/tc_line_string.rb +7 -15
- data/test/geos_capi/tc_misc.rb +26 -41
- data/test/geos_capi/tc_multi_line_string.rb +6 -14
- data/test/geos_capi/tc_multi_point.rb +7 -15
- data/test/geos_capi/tc_multi_polygon.rb +8 -18
- data/test/geos_capi/tc_parsing_unparsing.rb +11 -21
- data/test/geos_capi/tc_point.rb +12 -26
- data/test/geos_capi/tc_polygon.rb +52 -17
- data/test/geos_capi/tc_zmfactory.rb +7 -18
- data/test/geos_ffi/tc_factory.rb +7 -16
- data/test/geos_ffi/tc_geometry_collection.rb +7 -15
- data/test/geos_ffi/tc_line_string.rb +7 -15
- data/test/geos_ffi/tc_misc.rb +8 -18
- data/test/geos_ffi/tc_multi_line_string.rb +7 -15
- data/test/geos_ffi/tc_multi_point.rb +8 -16
- data/test/geos_ffi/tc_multi_polygon.rb +9 -18
- data/test/geos_ffi/tc_parsing_unparsing.rb +14 -24
- data/test/geos_ffi/tc_point.rb +13 -28
- data/test/geos_ffi/tc_polygon.rb +7 -17
- data/test/geos_ffi/tc_zmfactory.rb +8 -19
- data/test/projected_geographic/tc_factory.rb +7 -15
- data/test/projected_geographic/tc_geometry_collection.rb +7 -15
- data/test/projected_geographic/tc_line_string.rb +7 -15
- data/test/projected_geographic/tc_multi_line_string.rb +7 -16
- data/test/projected_geographic/tc_multi_point.rb +8 -17
- data/test/projected_geographic/tc_multi_polygon.rb +8 -16
- data/test/projected_geographic/tc_point.rb +11 -23
- data/test/projected_geographic/tc_polygon.rb +7 -15
- data/test/simple_cartesian/tc_calculations.rb +6 -22
- data/test/simple_cartesian/tc_factory.rb +7 -16
- data/test/simple_cartesian/tc_geometry_collection.rb +6 -15
- data/test/simple_cartesian/tc_line_string.rb +6 -15
- data/test/simple_cartesian/tc_multi_line_string.rb +6 -15
- data/test/simple_cartesian/tc_multi_point.rb +7 -16
- data/test/simple_cartesian/tc_multi_polygon.rb +7 -16
- data/test/simple_cartesian/tc_point.rb +10 -21
- data/test/simple_cartesian/tc_polygon.rb +6 -15
- data/test/simple_mercator/tc_factory.rb +6 -14
- data/test/simple_mercator/tc_geometry_collection.rb +6 -14
- data/test/simple_mercator/tc_line_string.rb +6 -14
- data/test/simple_mercator/tc_multi_line_string.rb +6 -15
- data/test/simple_mercator/tc_multi_point.rb +7 -16
- data/test/simple_mercator/tc_multi_polygon.rb +7 -15
- data/test/simple_mercator/tc_point.rb +11 -24
- data/test/simple_mercator/tc_polygon.rb +6 -14
- data/test/simple_mercator/tc_window.rb +10 -34
- data/test/spherical_geographic/tc_calculations.rb +5 -32
- data/test/spherical_geographic/tc_factory.rb +6 -15
- data/test/spherical_geographic/tc_geometry_collection.rb +6 -15
- data/test/spherical_geographic/tc_line_string.rb +6 -15
- data/test/spherical_geographic/tc_multi_line_string.rb +6 -15
- data/test/spherical_geographic/tc_multi_point.rb +7 -16
- data/test/spherical_geographic/tc_multi_polygon.rb +7 -16
- data/test/spherical_geographic/tc_point.rb +10 -22
- data/test/spherical_geographic/tc_polygon.rb +6 -15
- data/test/tc_cartesian_analysis.rb +4 -16
- data/test/tc_cartesian_bbox.rb +7 -21
- data/test/tc_mixins.rb +8 -25
- data/test/tc_oneoff.rb +5 -13
- data/test/tc_types.rb +7 -16
- data/test/wkrep/tc_wkb_generator.rb +63 -97
- data/test/wkrep/tc_wkb_parser.rb +63 -100
- data/test/wkrep/tc_wkt_generator.rb +54 -92
- data/test/wkrep/tc_wkt_parser.rb +84 -133
- metadata +39 -9
- data/lib/rgeo/coord_sys/srs_database/active_record_table.rb +0 -166
- data/test/coord_sys/tc_active_record_table.rb +0 -79
data/test/coord_sys/tc_ogc_cs.rb
CHANGED
@@ -4,54 +4,46 @@
|
|
4
4
|
#
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
|
7
|
-
require
|
8
|
-
require
|
9
|
-
|
7
|
+
require "test/unit"
|
8
|
+
require "rgeo"
|
10
9
|
|
11
10
|
module RGeo
|
12
|
-
module Tests
|
13
|
-
module CoordSys
|
14
|
-
|
15
|
-
class TestOgcCs < ::Test::Unit::TestCase # :nodoc:
|
16
|
-
|
17
|
-
|
11
|
+
module Tests # :nodoc:
|
12
|
+
module CoordSys # :nodoc:
|
13
|
+
class TestOgcCs < ::Test::Unit::TestCase # :nodoc:
|
18
14
|
# Handle differences in floating-point output.
|
19
15
|
|
20
16
|
def _lenient_regex_for(str_)
|
21
|
-
::Regexp.new(str_.gsub(/(\d)\.(\d{10,})/) do |
|
22
|
-
before_ =
|
23
|
-
after_ =
|
17
|
+
::Regexp.new(str_.gsub(/(\d)\.(\d{10,})/) do |_m_|
|
18
|
+
before_ = Regexp.last_match(1)
|
19
|
+
after_ = Regexp.last_match(2)[0, 10]
|
24
20
|
"#{before_}.#{after_}\\d*"
|
25
|
-
end.gsub(/(\.|\[|\]|\(|\)|\$|\^|\||\+)/){ |
|
21
|
+
end.gsub(/(\.|\[|\]|\(|\)|\$|\^|\||\+)/) { |_m_| "\\#{Regexp.last_match(1)}" })
|
26
22
|
end
|
27
23
|
|
28
|
-
|
29
24
|
def test_axis_info_by_value
|
30
|
-
obj_ = ::RGeo::CoordSys::CS::AxisInfo.create(
|
31
|
-
assert_equal(
|
25
|
+
obj_ = ::RGeo::CoordSys::CS::AxisInfo.create("N", ::RGeo::CoordSys::CS::AO_NORTH)
|
26
|
+
assert_equal("N", obj_.name)
|
32
27
|
assert_equal(::RGeo::CoordSys::CS::AO_NORTH, obj_.orientation)
|
33
28
|
assert_equal('AXIS["N",NORTH]', obj_.to_wkt)
|
34
29
|
end
|
35
30
|
|
36
|
-
|
37
31
|
def test_axis_info_by_name
|
38
|
-
obj_ = ::RGeo::CoordSys::CS::AxisInfo.create(
|
39
|
-
assert_equal(
|
32
|
+
obj_ = ::RGeo::CoordSys::CS::AxisInfo.create("S", "SOUTH")
|
33
|
+
assert_equal("S", obj_.name)
|
40
34
|
assert_equal(::RGeo::CoordSys::CS::AO_SOUTH, obj_.orientation)
|
41
35
|
assert_equal('AXIS["S",SOUTH]', obj_.to_wkt)
|
42
|
-
obj2_ = ::RGeo::CoordSys::CS::AxisInfo.create(
|
36
|
+
obj2_ = ::RGeo::CoordSys::CS::AxisInfo.create("S", ::RGeo::CoordSys::CS::AO_SOUTH)
|
43
37
|
assert_equal(obj_, obj2_)
|
44
38
|
end
|
45
39
|
|
46
|
-
|
47
40
|
def test_parameter
|
48
|
-
obj_ = ::RGeo::CoordSys::CS::ProjectionParameter.create(
|
49
|
-
assert_equal(
|
50
|
-
assert_equal(
|
41
|
+
obj_ = ::RGeo::CoordSys::CS::ProjectionParameter.create("false_easting", 400_000)
|
42
|
+
assert_equal("false_easting", obj_.name)
|
43
|
+
assert_equal(400_000, obj_.value)
|
51
44
|
assert_equal('PARAMETER["false_easting",400000.0]', obj_.to_wkt)
|
52
45
|
end
|
53
46
|
|
54
|
-
|
55
47
|
def test_towgs84
|
56
48
|
obj_ = ::RGeo::CoordSys::CS::WGS84ConversionInfo.create(1, 2, 3, 4, 5, 6, 7)
|
57
49
|
assert_equal(1, obj_.dx)
|
@@ -61,272 +53,251 @@ module RGeo
|
|
61
53
|
assert_equal(5, obj_.ey)
|
62
54
|
assert_equal(6, obj_.ez)
|
63
55
|
assert_equal(7, obj_.ppm)
|
64
|
-
assert_equal(
|
56
|
+
assert_equal("TOWGS84[1.0,2.0,3.0,4.0,5.0,6.0,7.0]", obj_.to_wkt)
|
65
57
|
end
|
66
58
|
|
67
|
-
|
68
59
|
def test_unit
|
69
|
-
obj_ = ::RGeo::CoordSys::CS::Unit.create(
|
70
|
-
assert_equal(
|
60
|
+
obj_ = ::RGeo::CoordSys::CS::Unit.create("metre", 1)
|
61
|
+
assert_equal("metre", obj_.name)
|
71
62
|
assert_equal(1, obj_.conversion_factor)
|
72
63
|
assert_nil(obj_.authority)
|
73
64
|
assert_equal('UNIT["metre",1.0]', obj_.to_wkt)
|
74
65
|
end
|
75
66
|
|
76
|
-
|
77
67
|
def test_unit_with_authority
|
78
|
-
obj_ = ::RGeo::CoordSys::CS::Unit.create(
|
79
|
-
assert_equal(
|
68
|
+
obj_ = ::RGeo::CoordSys::CS::Unit.create("metre", 1, "EPSG", 9001)
|
69
|
+
assert_equal("metre", obj_.name)
|
80
70
|
assert_equal(1, obj_.conversion_factor)
|
81
|
-
assert_equal(
|
82
|
-
assert_equal(
|
71
|
+
assert_equal("EPSG", obj_.authority)
|
72
|
+
assert_equal("9001", obj_.authority_code)
|
83
73
|
assert_equal('UNIT["metre",1.0,AUTHORITY["EPSG","9001"]]', obj_.to_wkt)
|
84
74
|
end
|
85
75
|
|
86
|
-
|
87
76
|
def test_linear_unit
|
88
|
-
obj_ = ::RGeo::CoordSys::CS::LinearUnit.create(
|
77
|
+
obj_ = ::RGeo::CoordSys::CS::LinearUnit.create("metre", 1)
|
89
78
|
assert_equal(1, obj_.meters_per_unit)
|
90
79
|
assert_equal('UNIT["metre",1.0]', obj_.to_wkt)
|
91
80
|
end
|
92
81
|
|
93
|
-
|
94
82
|
def test_angular_unit
|
95
|
-
obj_ = ::RGeo::CoordSys::CS::AngularUnit.create(
|
83
|
+
obj_ = ::RGeo::CoordSys::CS::AngularUnit.create("radian", 1)
|
96
84
|
assert_equal(1, obj_.radians_per_unit)
|
97
85
|
assert_equal('UNIT["radian",1.0]', obj_.to_wkt)
|
98
86
|
end
|
99
87
|
|
100
|
-
|
101
88
|
def test_prime_meridian
|
102
|
-
obj1_ = ::RGeo::CoordSys::CS::AngularUnit.create(
|
103
|
-
obj_ = ::RGeo::CoordSys::CS::PrimeMeridian.create(
|
104
|
-
assert_equal(
|
89
|
+
obj1_ = ::RGeo::CoordSys::CS::AngularUnit.create("radian", 1)
|
90
|
+
obj_ = ::RGeo::CoordSys::CS::PrimeMeridian.create("Greenwich", obj1_, 0, "EPSG", "8901")
|
91
|
+
assert_equal("Greenwich", obj_.name)
|
105
92
|
assert_equal(0, obj_.longitude)
|
106
93
|
assert_equal('PRIMEM["Greenwich",0.0,AUTHORITY["EPSG","8901"]]', obj_.to_wkt)
|
107
94
|
end
|
108
95
|
|
109
|
-
|
110
96
|
def test_create_flattened_sphere
|
111
|
-
obj1_ = ::RGeo::CoordSys::CS::LinearUnit.create(
|
112
|
-
obj_ = ::RGeo::CoordSys::CS::Ellipsoid.create_flattened_sphere(
|
113
|
-
assert_equal(
|
114
|
-
assert_equal(
|
97
|
+
obj1_ = ::RGeo::CoordSys::CS::LinearUnit.create("metre", 1)
|
98
|
+
obj_ = ::RGeo::CoordSys::CS::Ellipsoid.create_flattened_sphere("WGS 84", 6_378_137, 298.257223563, obj1_, "EPSG", "7030")
|
99
|
+
assert_equal("WGS 84", obj_.name)
|
100
|
+
assert_equal(6_378_137, obj_.semi_major_axis)
|
115
101
|
assert_in_delta(298.257223563, obj_.inverse_flattening, 0.1)
|
116
|
-
assert_in_delta(
|
117
|
-
assert_equal(
|
118
|
-
assert_equal(
|
102
|
+
assert_in_delta(6_356_752.314245, obj_.semi_minor_axis, 0.1)
|
103
|
+
assert_equal("EPSG", obj_.authority)
|
104
|
+
assert_equal("7030", obj_.authority_code)
|
119
105
|
assert_equal('SPHEROID["WGS 84",6378137.0,298.257223563,AUTHORITY["EPSG","7030"]]', obj_.to_wkt)
|
120
106
|
end
|
121
107
|
|
122
|
-
|
123
108
|
def test_create_unflattened_sphere
|
124
|
-
obj1_ = ::RGeo::CoordSys::CS::LinearUnit.create(
|
125
|
-
obj_ = ::RGeo::CoordSys::CS::Ellipsoid.create_flattened_sphere(
|
126
|
-
assert_equal(
|
127
|
-
assert_equal(
|
109
|
+
obj1_ = ::RGeo::CoordSys::CS::LinearUnit.create("metre", 1)
|
110
|
+
obj_ = ::RGeo::CoordSys::CS::Ellipsoid.create_flattened_sphere("Popular Visualisation Sphere", 6_378_137, 0, obj1_, "EPSG", "7059")
|
111
|
+
assert_equal("Popular Visualisation Sphere", obj_.name)
|
112
|
+
assert_equal(6_378_137, obj_.semi_major_axis)
|
128
113
|
assert_equal(0, obj_.inverse_flattening)
|
129
|
-
assert_equal(
|
130
|
-
assert_equal(
|
131
|
-
assert_equal(
|
114
|
+
assert_equal(6_378_137, obj_.semi_minor_axis)
|
115
|
+
assert_equal("EPSG", obj_.authority)
|
116
|
+
assert_equal("7059", obj_.authority_code)
|
132
117
|
assert_equal('SPHEROID["Popular Visualisation Sphere",6378137.0,0.0,AUTHORITY["EPSG","7059"]]', obj_.to_wkt)
|
133
118
|
end
|
134
119
|
|
135
|
-
|
136
120
|
def test_create_ellipsoid
|
137
|
-
obj1_ = ::RGeo::CoordSys::CS::LinearUnit.create(
|
138
|
-
obj_ = ::RGeo::CoordSys::CS::Ellipsoid.create_ellipsoid(
|
121
|
+
obj1_ = ::RGeo::CoordSys::CS::LinearUnit.create("metre", 1)
|
122
|
+
obj_ = ::RGeo::CoordSys::CS::Ellipsoid.create_ellipsoid("WGS 84", 6_378_137, 6_356_752.314245, obj1_, "EPSG", "7030")
|
139
123
|
assert_in_delta(298.257223563, obj_.inverse_flattening, 0.1)
|
140
124
|
end
|
141
125
|
|
142
|
-
|
143
126
|
def test_create_spherical_ellipsoid
|
144
|
-
obj1_ = ::RGeo::CoordSys::CS::LinearUnit.create(
|
145
|
-
obj_ = ::RGeo::CoordSys::CS::Ellipsoid.create_ellipsoid(
|
127
|
+
obj1_ = ::RGeo::CoordSys::CS::LinearUnit.create("metre", 1)
|
128
|
+
obj_ = ::RGeo::CoordSys::CS::Ellipsoid.create_ellipsoid("Popular Visualisation Sphere", 6_378_137, 6_378_137, obj1_, "EPSG", "7059")
|
146
129
|
assert_equal(0, obj_.inverse_flattening)
|
147
130
|
end
|
148
131
|
|
149
|
-
|
150
132
|
def test_local_datum
|
151
|
-
obj_ = ::RGeo::CoordSys::CS::LocalDatum.create(
|
152
|
-
assert_equal(
|
133
|
+
obj_ = ::RGeo::CoordSys::CS::LocalDatum.create("Random Local Datum", ::RGeo::CoordSys::CS::LD_MIN)
|
134
|
+
assert_equal("Random Local Datum", obj_.name)
|
153
135
|
assert_equal(::RGeo::CoordSys::CS::LD_MIN, obj_.datum_type)
|
154
136
|
assert_equal('LOCAL_DATUM["Random Local Datum",10000]', obj_.to_wkt)
|
155
137
|
end
|
156
138
|
|
157
|
-
|
158
139
|
def test_local_datum_with_extension
|
159
|
-
obj_ = ::RGeo::CoordSys::CS::LocalDatum.create(
|
160
|
-
assert_equal(
|
140
|
+
obj_ = ::RGeo::CoordSys::CS::LocalDatum.create("Random Local Datum", ::RGeo::CoordSys::CS::LD_MIN, nil, nil, nil, nil, nil, foo: :bar)
|
141
|
+
assert_equal("bar", obj_.extension(:foo))
|
161
142
|
assert_nil(obj_.extension(:bar))
|
162
143
|
assert_equal('LOCAL_DATUM["Random Local Datum",10000,EXTENSION["foo","bar"]]', obj_.to_wkt)
|
163
144
|
end
|
164
145
|
|
165
|
-
|
166
146
|
def test_vertical_datum
|
167
|
-
obj_ = ::RGeo::CoordSys::CS::VerticalDatum.create(
|
168
|
-
assert_equal(
|
147
|
+
obj_ = ::RGeo::CoordSys::CS::VerticalDatum.create("Ordnance Datum Newlyn", ::RGeo::CoordSys::CS::VD_GEOID_MODE_DERIVED, "EPSG", "5101")
|
148
|
+
assert_equal("Ordnance Datum Newlyn", obj_.name)
|
169
149
|
assert_equal(::RGeo::CoordSys::CS::VD_GEOID_MODE_DERIVED, obj_.datum_type)
|
170
|
-
assert_equal(
|
171
|
-
assert_equal(
|
150
|
+
assert_equal("EPSG", obj_.authority)
|
151
|
+
assert_equal("5101", obj_.authority_code)
|
172
152
|
assert_equal('VERT_DATUM["Ordnance Datum Newlyn",2005,AUTHORITY["EPSG","5101"]]', obj_.to_wkt)
|
173
153
|
end
|
174
154
|
|
175
|
-
|
176
155
|
def test_horizontal_datum
|
177
|
-
obj1_ = ::RGeo::CoordSys::CS::LinearUnit.create(
|
178
|
-
obj2_ = ::RGeo::CoordSys::CS::Ellipsoid.create_ellipsoid(
|
156
|
+
obj1_ = ::RGeo::CoordSys::CS::LinearUnit.create("metre", 1)
|
157
|
+
obj2_ = ::RGeo::CoordSys::CS::Ellipsoid.create_ellipsoid("Popular Visualisation Sphere", 6_378_137, 6_378_137, obj1_, "EPSG", "7059")
|
179
158
|
obj3_ = ::RGeo::CoordSys::CS::WGS84ConversionInfo.create(0, 0, 0, 0, 0, 0, 0)
|
180
|
-
obj_ = ::RGeo::CoordSys::CS::HorizontalDatum.create(
|
181
|
-
assert_equal(
|
159
|
+
obj_ = ::RGeo::CoordSys::CS::HorizontalDatum.create("Popular_Visualisation_Datum", ::RGeo::CoordSys::CS::HD_GEOCENTRIC, obj2_, obj3_, "EPSG", "6055")
|
160
|
+
assert_equal("Popular_Visualisation_Datum", obj_.name)
|
182
161
|
assert_equal(::RGeo::CoordSys::CS::HD_GEOCENTRIC, obj_.datum_type)
|
183
|
-
assert_equal(
|
184
|
-
assert_equal(
|
162
|
+
assert_equal("EPSG", obj_.authority)
|
163
|
+
assert_equal("6055", obj_.authority_code)
|
185
164
|
assert_equal('DATUM["Popular_Visualisation_Datum",SPHEROID["Popular Visualisation Sphere",6378137.0,0.0,AUTHORITY["EPSG","7059"]],TOWGS84[0.0,0.0,0.0,0.0,0.0,0.0,0.0],AUTHORITY["EPSG","6055"]]', obj_.to_wkt)
|
186
165
|
end
|
187
166
|
|
188
|
-
|
189
167
|
def test_projection
|
190
|
-
obj_ = ::RGeo::CoordSys::CS::Projection.create(
|
191
|
-
assert_equal(
|
192
|
-
assert_equal(
|
168
|
+
obj_ = ::RGeo::CoordSys::CS::Projection.create("Transverse_Mercator", "Transverse_Mercator", [])
|
169
|
+
assert_equal("Transverse_Mercator", obj_.name)
|
170
|
+
assert_equal("Transverse_Mercator", obj_.class_name)
|
193
171
|
assert_equal(0, obj_.num_parameters)
|
194
172
|
assert_equal('PROJECTION["Transverse_Mercator"]', obj_.to_wkt)
|
195
173
|
end
|
196
174
|
|
197
|
-
|
198
175
|
def test_local_coordinate_system
|
199
|
-
obj1_ = ::RGeo::CoordSys::CS::LocalDatum.create(
|
200
|
-
obj2_ = ::RGeo::CoordSys::CS::LinearUnit.create(
|
201
|
-
obj3_ = ::RGeo::CoordSys::CS::AxisInfo.create(
|
202
|
-
obj4_ = ::RGeo::CoordSys::CS::AxisInfo.create(
|
203
|
-
obj_ = ::RGeo::CoordSys::CS::LocalCoordinateSystem.create(
|
204
|
-
assert_equal(
|
176
|
+
obj1_ = ::RGeo::CoordSys::CS::LocalDatum.create("Random Local Datum", ::RGeo::CoordSys::CS::LD_MIN)
|
177
|
+
obj2_ = ::RGeo::CoordSys::CS::LinearUnit.create("metre", 1, "EPSG", 9001)
|
178
|
+
obj3_ = ::RGeo::CoordSys::CS::AxisInfo.create("N", ::RGeo::CoordSys::CS::AO_NORTH)
|
179
|
+
obj4_ = ::RGeo::CoordSys::CS::AxisInfo.create("E", ::RGeo::CoordSys::CS::AO_EAST)
|
180
|
+
obj_ = ::RGeo::CoordSys::CS::LocalCoordinateSystem.create("My CS", obj1_, obj2_, [obj3_, obj4_])
|
181
|
+
assert_equal("My CS", obj_.name)
|
205
182
|
assert_equal(2, obj_.dimension)
|
206
|
-
assert_equal(
|
207
|
-
assert_equal(
|
208
|
-
assert_equal(
|
209
|
-
assert_equal(
|
210
|
-
assert_equal(
|
183
|
+
assert_equal("Random Local Datum", obj_.local_datum.name)
|
184
|
+
assert_equal("N", obj_.get_axis(0).name)
|
185
|
+
assert_equal("E", obj_.get_axis(1).name)
|
186
|
+
assert_equal("metre", obj_.get_units(0).name)
|
187
|
+
assert_equal("metre", obj_.get_units(1).name)
|
211
188
|
assert_equal('LOCAL_CS["My CS",LOCAL_DATUM["Random Local Datum",10000],UNIT["metre",1.0,AUTHORITY["EPSG","9001"]],AXIS["N",NORTH],AXIS["E",EAST]]', obj_.to_wkt)
|
212
189
|
end
|
213
190
|
|
214
|
-
|
215
191
|
def test_geocentric_coordinate_system
|
216
|
-
obj1_ = ::RGeo::CoordSys::CS::Ellipsoid.create_flattened_sphere(
|
217
|
-
obj2_ = ::RGeo::CoordSys::CS::HorizontalDatum.create(
|
218
|
-
obj3_ = ::RGeo::CoordSys::CS::PrimeMeridian.create(
|
219
|
-
obj4_ = ::RGeo::CoordSys::CS::LinearUnit.create(
|
220
|
-
obj5_ = ::RGeo::CoordSys::CS::AxisInfo.create(
|
221
|
-
obj6_ = ::RGeo::CoordSys::CS::AxisInfo.create(
|
222
|
-
obj7_ = ::RGeo::CoordSys::CS::AxisInfo.create(
|
223
|
-
obj_ = ::RGeo::CoordSys::CS::GeocentricCoordinateSystem.create(
|
224
|
-
assert_equal(
|
192
|
+
obj1_ = ::RGeo::CoordSys::CS::Ellipsoid.create_flattened_sphere("WGS 84", 6_378_137, 298.257223563, nil, "EPSG", "7030")
|
193
|
+
obj2_ = ::RGeo::CoordSys::CS::HorizontalDatum.create("World Geodetic System 1984", ::RGeo::CoordSys::CS::HD_GEOCENTRIC, obj1_, nil, "EPSG", "6326")
|
194
|
+
obj3_ = ::RGeo::CoordSys::CS::PrimeMeridian.create("Greenwich", nil, 0.0, "EPSG", "8901")
|
195
|
+
obj4_ = ::RGeo::CoordSys::CS::LinearUnit.create("m", 1.0)
|
196
|
+
obj5_ = ::RGeo::CoordSys::CS::AxisInfo.create("Geocentric X", ::RGeo::CoordSys::CS::AO_OTHER)
|
197
|
+
obj6_ = ::RGeo::CoordSys::CS::AxisInfo.create("Geocentric Y", ::RGeo::CoordSys::CS::AO_EAST)
|
198
|
+
obj7_ = ::RGeo::CoordSys::CS::AxisInfo.create("Geocentric Z", ::RGeo::CoordSys::CS::AO_NORTH)
|
199
|
+
obj_ = ::RGeo::CoordSys::CS::GeocentricCoordinateSystem.create("WGS 84 (geocentric)", obj2_, obj3_, obj4_, obj5_, obj6_, obj7_, "EPSG", 4328)
|
200
|
+
assert_equal("WGS 84 (geocentric)", obj_.name)
|
225
201
|
assert_equal(3, obj_.dimension)
|
226
|
-
assert_equal(
|
227
|
-
assert_equal(
|
228
|
-
assert_equal(
|
229
|
-
assert_equal(
|
230
|
-
assert_equal(
|
231
|
-
assert_equal(
|
232
|
-
assert_equal(
|
233
|
-
assert_equal(
|
234
|
-
assert_equal(
|
202
|
+
assert_equal("World Geodetic System 1984", obj_.horizontal_datum.name)
|
203
|
+
assert_equal("Greenwich", obj_.prime_meridian.name)
|
204
|
+
assert_equal("m", obj_.linear_unit.name)
|
205
|
+
assert_equal("Geocentric X", obj_.get_axis(0).name)
|
206
|
+
assert_equal("Geocentric Y", obj_.get_axis(1).name)
|
207
|
+
assert_equal("Geocentric Z", obj_.get_axis(2).name)
|
208
|
+
assert_equal("m", obj_.get_units(0).name)
|
209
|
+
assert_equal("m", obj_.get_units(1).name)
|
210
|
+
assert_equal("m", obj_.get_units(2).name)
|
235
211
|
assert_equal('GEOCCS["WGS 84 (geocentric)",DATUM["World Geodetic System 1984",SPHEROID["WGS 84",6378137.0,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0.0,AUTHORITY["EPSG","8901"]],UNIT["m",1.0],AXIS["Geocentric X",OTHER],AXIS["Geocentric Y",EAST],AXIS["Geocentric Z",NORTH],AUTHORITY["EPSG","4328"]]', obj_.to_wkt)
|
236
212
|
end
|
237
213
|
|
238
|
-
|
239
214
|
def test_vertical_coordinate_system
|
240
|
-
obj1_ = ::RGeo::CoordSys::CS::VerticalDatum.create(
|
241
|
-
obj2_ = ::RGeo::CoordSys::CS::LinearUnit.create(
|
242
|
-
obj3_ = ::RGeo::CoordSys::CS::AxisInfo.create(
|
243
|
-
obj_ = ::RGeo::CoordSys::CS::VerticalCoordinateSystem.create(
|
244
|
-
assert_equal(
|
215
|
+
obj1_ = ::RGeo::CoordSys::CS::VerticalDatum.create("Ordnance Datum Newlyn", ::RGeo::CoordSys::CS::VD_GEOID_MODE_DERIVED, "EPSG", 5101)
|
216
|
+
obj2_ = ::RGeo::CoordSys::CS::LinearUnit.create("metre", 1, "EPSG", 9001)
|
217
|
+
obj3_ = ::RGeo::CoordSys::CS::AxisInfo.create("Up", ::RGeo::CoordSys::CS::AO_UP)
|
218
|
+
obj_ = ::RGeo::CoordSys::CS::VerticalCoordinateSystem.create("Newlyn", obj1_, obj2_, obj3_, "EPSG", 5701)
|
219
|
+
assert_equal("Newlyn", obj_.name)
|
245
220
|
assert_equal(1, obj_.dimension)
|
246
|
-
assert_equal(
|
247
|
-
assert_equal(
|
248
|
-
assert_equal(
|
249
|
-
assert_equal(
|
221
|
+
assert_equal("Ordnance Datum Newlyn", obj_.vertical_datum.name)
|
222
|
+
assert_equal("metre", obj_.vertical_unit.name)
|
223
|
+
assert_equal("Up", obj_.get_axis(0).name)
|
224
|
+
assert_equal("metre", obj_.get_units(0).name)
|
250
225
|
assert_equal('VERT_CS["Newlyn",VERT_DATUM["Ordnance Datum Newlyn",2005,AUTHORITY["EPSG","5101"]],UNIT["metre",1.0,AUTHORITY["EPSG","9001"]],AXIS["Up",UP],AUTHORITY["EPSG","5701"]]', obj_.to_wkt)
|
251
226
|
end
|
252
227
|
|
253
|
-
|
254
228
|
def test_geographic_coordinate_system
|
255
|
-
obj1_ = ::RGeo::CoordSys::CS::Ellipsoid.create_flattened_sphere(
|
256
|
-
obj2_ = ::RGeo::CoordSys::CS::AngularUnit.create(
|
257
|
-
obj3_ = ::RGeo::CoordSys::CS::HorizontalDatum.create(
|
258
|
-
obj4_ = ::RGeo::CoordSys::CS::PrimeMeridian.create(
|
259
|
-
obj_ = ::RGeo::CoordSys::CS::GeographicCoordinateSystem.create(
|
260
|
-
assert_equal(
|
229
|
+
obj1_ = ::RGeo::CoordSys::CS::Ellipsoid.create_flattened_sphere("WGS 84", 6_378_137, 298.257223563, nil, "EPSG", "7030")
|
230
|
+
obj2_ = ::RGeo::CoordSys::CS::AngularUnit.create("degree", 0.01745329251994328, "EPSG", 9122)
|
231
|
+
obj3_ = ::RGeo::CoordSys::CS::HorizontalDatum.create("WGS_1984", ::RGeo::CoordSys::CS::HD_GEOCENTRIC, obj1_, nil, "EPSG", "6326")
|
232
|
+
obj4_ = ::RGeo::CoordSys::CS::PrimeMeridian.create("Greenwich", nil, 0, "EPSG", "8901")
|
233
|
+
obj_ = ::RGeo::CoordSys::CS::GeographicCoordinateSystem.create("WGS 84", obj2_, obj3_, obj4_, nil, nil, "EPSG", 4326)
|
234
|
+
assert_equal("WGS 84", obj_.name)
|
261
235
|
assert_equal(2, obj_.dimension)
|
262
|
-
assert_equal(
|
263
|
-
assert_equal(
|
264
|
-
assert_equal(
|
236
|
+
assert_equal("WGS_1984", obj_.horizontal_datum.name)
|
237
|
+
assert_equal("Greenwich", obj_.prime_meridian.name)
|
238
|
+
assert_equal("degree", obj_.angular_unit.name)
|
265
239
|
assert_nil(obj_.get_axis(0))
|
266
240
|
assert_nil(obj_.get_axis(1))
|
267
|
-
assert_equal(
|
268
|
-
assert_equal(
|
241
|
+
assert_equal("degree", obj_.get_units(0).name)
|
242
|
+
assert_equal("degree", obj_.get_units(1).name)
|
269
243
|
assert_match(_lenient_regex_for('GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137.0,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0.0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]'), obj_.to_wkt)
|
270
244
|
end
|
271
245
|
|
272
|
-
|
273
246
|
def test_projected_coordinate_system
|
274
|
-
obj1_ = ::RGeo::CoordSys::CS::Ellipsoid.create_flattened_sphere(
|
247
|
+
obj1_ = ::RGeo::CoordSys::CS::Ellipsoid.create_flattened_sphere("Airy 1830", 6_377_563.396, 299.3249646, nil, "EPSG", "7001")
|
275
248
|
obj2_ = ::RGeo::CoordSys::CS::WGS84ConversionInfo.create(375, -111, 431, 0, 0, 0, 0)
|
276
|
-
obj3_ = ::RGeo::CoordSys::CS::AngularUnit.create(
|
277
|
-
obj4_ = ::RGeo::CoordSys::CS::HorizontalDatum.create(
|
278
|
-
obj5_ = ::RGeo::CoordSys::CS::PrimeMeridian.create(
|
279
|
-
obj6_ = ::RGeo::CoordSys::CS::AxisInfo.create(
|
280
|
-
obj7_ = ::RGeo::CoordSys::CS::AxisInfo.create(
|
281
|
-
obj8_ = ::RGeo::CoordSys::CS::GeographicCoordinateSystem.create(
|
282
|
-
obj9_ = ::RGeo::CoordSys::CS::ProjectionParameter.create(
|
283
|
-
obj10_ = ::RGeo::CoordSys::CS::ProjectionParameter.create(
|
284
|
-
obj11_ = ::RGeo::CoordSys::CS::ProjectionParameter.create(
|
285
|
-
obj12_ = ::RGeo::CoordSys::CS::ProjectionParameter.create(
|
286
|
-
obj13_ = ::RGeo::CoordSys::CS::ProjectionParameter.create(
|
287
|
-
obj14_ = ::RGeo::CoordSys::CS::Projection.create(
|
288
|
-
obj15_ = ::RGeo::CoordSys::CS::LinearUnit.create(
|
289
|
-
obj16_ = ::RGeo::CoordSys::CS::AxisInfo.create(
|
290
|
-
obj17_ = ::RGeo::CoordSys::CS::AxisInfo.create(
|
291
|
-
obj_ = ::RGeo::CoordSys::CS::ProjectedCoordinateSystem.create(
|
292
|
-
assert_equal(
|
249
|
+
obj3_ = ::RGeo::CoordSys::CS::AngularUnit.create("DMSH", 0.0174532925199433, "EPSG", 9108)
|
250
|
+
obj4_ = ::RGeo::CoordSys::CS::HorizontalDatum.create("OSGB_1936", ::RGeo::CoordSys::CS::HD_CLASSIC, obj1_, obj2_, "EPSG", "6277")
|
251
|
+
obj5_ = ::RGeo::CoordSys::CS::PrimeMeridian.create("Greenwich", nil, 0, "EPSG", "8901")
|
252
|
+
obj6_ = ::RGeo::CoordSys::CS::AxisInfo.create("Lat", ::RGeo::CoordSys::CS::AO_NORTH)
|
253
|
+
obj7_ = ::RGeo::CoordSys::CS::AxisInfo.create("Long", ::RGeo::CoordSys::CS::AO_EAST)
|
254
|
+
obj8_ = ::RGeo::CoordSys::CS::GeographicCoordinateSystem.create("OSGB 1936", obj3_, obj4_, obj5_, obj6_, obj7_, "EPSG", 4277)
|
255
|
+
obj9_ = ::RGeo::CoordSys::CS::ProjectionParameter.create("latitude_of_origin", 49)
|
256
|
+
obj10_ = ::RGeo::CoordSys::CS::ProjectionParameter.create("central_meridian", -2)
|
257
|
+
obj11_ = ::RGeo::CoordSys::CS::ProjectionParameter.create("scale_factor", 0.999601272)
|
258
|
+
obj12_ = ::RGeo::CoordSys::CS::ProjectionParameter.create("false_easting", 400_000)
|
259
|
+
obj13_ = ::RGeo::CoordSys::CS::ProjectionParameter.create("false_northing", -100_000)
|
260
|
+
obj14_ = ::RGeo::CoordSys::CS::Projection.create("Transverse_Mercator", "Transverse_Mercator", [obj9_, obj10_, obj11_, obj12_, obj13_])
|
261
|
+
obj15_ = ::RGeo::CoordSys::CS::LinearUnit.create("metre", 1, "EPSG", 9001)
|
262
|
+
obj16_ = ::RGeo::CoordSys::CS::AxisInfo.create("E", ::RGeo::CoordSys::CS::AO_EAST)
|
263
|
+
obj17_ = ::RGeo::CoordSys::CS::AxisInfo.create("N", ::RGeo::CoordSys::CS::AO_NORTH)
|
264
|
+
obj_ = ::RGeo::CoordSys::CS::ProjectedCoordinateSystem.create("OSGB 1936 / British National Grid", obj8_, obj14_, obj15_, obj16_, obj17_, "EPSG", 27_700)
|
265
|
+
assert_equal("OSGB 1936 / British National Grid", obj_.name)
|
293
266
|
assert_equal(2, obj_.dimension)
|
294
|
-
assert_equal(
|
295
|
-
assert_equal(
|
296
|
-
assert_equal(
|
267
|
+
assert_equal("OSGB_1936", obj_.horizontal_datum.name)
|
268
|
+
assert_equal("OSGB 1936", obj_.geographic_coordinate_system.name)
|
269
|
+
assert_equal("Transverse_Mercator", obj_.projection.name)
|
297
270
|
assert_equal(5, obj_.projection.num_parameters)
|
298
|
-
assert_equal(
|
271
|
+
assert_equal("latitude_of_origin", obj_.projection.get_parameter(0).name)
|
299
272
|
assert_equal(49, obj_.projection.get_parameter(0).value)
|
300
|
-
assert_equal(
|
301
|
-
assert_equal(-
|
302
|
-
assert_equal(
|
303
|
-
assert_equal(
|
304
|
-
assert_equal(
|
305
|
-
assert_equal(
|
306
|
-
assert_equal(
|
273
|
+
assert_equal("false_northing", obj_.projection.get_parameter(4).name)
|
274
|
+
assert_equal(-100_000, obj_.projection.get_parameter(4).value)
|
275
|
+
assert_equal("metre", obj_.linear_unit.name)
|
276
|
+
assert_equal("E", obj_.get_axis(0).name)
|
277
|
+
assert_equal("N", obj_.get_axis(1).name)
|
278
|
+
assert_equal("metre", obj_.get_units(0).name)
|
279
|
+
assert_equal("metre", obj_.get_units(1).name)
|
307
280
|
assert_equal('PROJCS["OSGB 1936 / British National Grid",GEOGCS["OSGB 1936",DATUM["OSGB_1936",SPHEROID["Airy 1830",6377563.396,299.3249646,AUTHORITY["EPSG","7001"]],TOWGS84[375.0,-111.0,431.0,0.0,0.0,0.0,0.0],AUTHORITY["EPSG","6277"]],PRIMEM["Greenwich",0.0,AUTHORITY["EPSG","8901"]],UNIT["DMSH",0.0174532925199433,AUTHORITY["EPSG","9108"]],AXIS["Lat",NORTH],AXIS["Long",EAST],AUTHORITY["EPSG","4277"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",49.0],PARAMETER["central_meridian",-2.0],PARAMETER["scale_factor",0.999601272],PARAMETER["false_easting",400000.0],PARAMETER["false_northing",-100000.0],UNIT["metre",1.0,AUTHORITY["EPSG","9001"]],AXIS["E",EAST],AXIS["N",NORTH],AUTHORITY["EPSG","27700"]]', obj_.to_wkt)
|
308
281
|
end
|
309
282
|
|
310
|
-
|
311
283
|
def test_parse_epsg_6055
|
312
284
|
input_ = 'DATUM["Popular_Visualisation_Datum",SPHEROID["Popular Visualisation Sphere",6378137.0,0.0,AUTHORITY["EPSG","7059"]],TOWGS84[0.0,0.0,0.0,0.0,0.0,0.0,0.0],AUTHORITY["EPSG","6055"]]'
|
313
285
|
obj_ = ::RGeo::CoordSys::CS.create_from_wkt(input_)
|
314
286
|
assert_kind_of(::RGeo::CoordSys::CS::HorizontalDatum, obj_)
|
315
|
-
assert_equal(
|
287
|
+
assert_equal("Popular_Visualisation_Datum", obj_.name)
|
316
288
|
assert_equal(::RGeo::CoordSys::CS::HD_GEOCENTRIC, obj_.datum_type)
|
317
|
-
assert_equal(
|
318
|
-
assert_equal(
|
319
|
-
assert_equal(
|
320
|
-
assert_equal(
|
289
|
+
assert_equal("EPSG", obj_.authority)
|
290
|
+
assert_equal("6055", obj_.authority_code)
|
291
|
+
assert_equal("Popular Visualisation Sphere", obj_.ellipsoid.name)
|
292
|
+
assert_equal(6_378_137, obj_.ellipsoid.semi_major_axis)
|
321
293
|
assert_equal(0, obj_.ellipsoid.inverse_flattening)
|
322
|
-
assert_equal(
|
323
|
-
assert_equal(
|
324
|
-
assert_equal(
|
294
|
+
assert_equal(6_378_137, obj_.ellipsoid.semi_minor_axis)
|
295
|
+
assert_equal("EPSG", obj_.ellipsoid.authority)
|
296
|
+
assert_equal("7059", obj_.ellipsoid.authority_code)
|
325
297
|
assert_equal(0, obj_.wgs84_parameters.dx)
|
326
298
|
assert_equal(input_, obj_.to_wkt)
|
327
299
|
end
|
328
300
|
|
329
|
-
|
330
301
|
def test_parse_epsg_7405
|
331
302
|
input_ = 'COMPD_CS["OSGB36 / British National Grid + ODN",PROJCS["OSGB 1936 / British National Grid",GEOGCS["OSGB 1936",DATUM["OSGB 1936",SPHEROID["Airy 1830",6377563.396,299.3249646,AUTHORITY["EPSG","7001"]],TOWGS84[446.448,-125.157,542.06,0.15,0.247,0.842,-4.2261596151967575],AUTHORITY["EPSG","6277"]],PRIMEM["Greenwich",0.0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.017453292519943295],AXIS["Geodetic latitude",NORTH],AXIS["Geodetic longitude",EAST],AUTHORITY["EPSG","4277"]],PROJECTION["Transverse Mercator",AUTHORITY["EPSG","9807"]],PARAMETER["central_meridian",-2.0],PARAMETER["latitude_of_origin",49.0],PARAMETER["scale_factor",0.9996012717],PARAMETER["false_easting",400000.0],PARAMETER["false_northing",-100000.0],UNIT["m",1.0],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","27700"]],VERT_CS["Newlyn",VERT_DATUM["Ordnance Datum Newlyn",2005,AUTHORITY["EPSG","5101"]],UNIT["m",1.0],AXIS["Gravity-related height",UP],AUTHORITY["EPSG","5701"]],AUTHORITY["EPSG","7405"]]'
|
332
303
|
obj_ = ::RGeo::CoordSys::CS.create_from_wkt(input_)
|
@@ -337,17 +308,15 @@ module RGeo
|
|
337
308
|
assert_match(_lenient_regex_for(input_), obj_.to_wkt)
|
338
309
|
end
|
339
310
|
|
340
|
-
|
341
311
|
def test_parse_local_datum_with_extension
|
342
312
|
input_ = 'LOCAL_DATUM["Random Local Datum",10000,EXTENSION["foo","bar"]]'
|
343
313
|
obj_ = ::RGeo::CoordSys::CS.create_from_wkt(input_)
|
344
314
|
assert_kind_of(::RGeo::CoordSys::CS::LocalDatum, obj_)
|
345
|
-
assert_equal(
|
315
|
+
assert_equal("bar", obj_.extension(:foo))
|
346
316
|
assert_nil(obj_.extension(:bar))
|
347
317
|
assert_equal(input_, obj_.to_wkt)
|
348
318
|
end
|
349
319
|
|
350
|
-
|
351
320
|
def test_marshal_roundtrip
|
352
321
|
input_ = 'COMPD_CS["OSGB36 / British National Grid + ODN",PROJCS["OSGB 1936 / British National Grid",GEOGCS["OSGB 1936",DATUM["OSGB 1936",SPHEROID["Airy 1830",6377563.396,299.3249646,AUTHORITY["EPSG","7001"]],TOWGS84[446.448,-125.157,542.06,0.15,0.247,0.842,-4.2261596151967575],AUTHORITY["EPSG","6277"]],PRIMEM["Greenwich",0.0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.017453292519943295],AXIS["Geodetic latitude",NORTH],AXIS["Geodetic longitude",EAST],AUTHORITY["EPSG","4277"]],PROJECTION["Transverse Mercator",AUTHORITY["EPSG","9807"]],PARAMETER["central_meridian",-2.0],PARAMETER["latitude_of_origin",49.0],PARAMETER["scale_factor",0.9996012717],PARAMETER["false_easting",400000.0],PARAMETER["false_northing",-100000.0],UNIT["m",1.0],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","27700"]],VERT_CS["Newlyn",VERT_DATUM["Ordnance Datum Newlyn",2005,AUTHORITY["EPSG","5101"]],UNIT["m",1.0],AXIS["Gravity-related height",UP],AUTHORITY["EPSG","5701"]],AUTHORITY["EPSG","7405"]]'
|
353
322
|
obj1_ = ::RGeo::CoordSys::CS.create_from_wkt(input_)
|
@@ -356,7 +325,6 @@ module RGeo
|
|
356
325
|
assert_equal(obj1_, obj2_)
|
357
326
|
end
|
358
327
|
|
359
|
-
|
360
328
|
if ::RGeo.yaml_supported?
|
361
329
|
|
362
330
|
def test_yaml_roundtrip
|
@@ -368,10 +336,7 @@ module RGeo
|
|
368
336
|
end
|
369
337
|
|
370
338
|
end
|
371
|
-
|
372
|
-
|
373
339
|
end
|
374
|
-
|
375
340
|
end
|
376
341
|
end
|
377
342
|
end
|