rgeo 0.1.19 → 0.1.20
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +11 -0
- data/README.rdoc +23 -7
- data/Version +1 -1
- data/ext/geos_c_impl/factory.c +1 -1
- data/{lib/rgeo/geography/simple_mercator.rb → ext/proj4_c_impl/extconf.rb} +35 -30
- data/ext/proj4_c_impl/main.c +256 -0
- data/lib/rgeo.rb +54 -42
- data/lib/rgeo/active_record/arel_modifications.rb +2 -2
- data/lib/rgeo/active_record/base_modifications.rb +1 -1
- data/lib/rgeo/active_record/mysql_common.rb +12 -12
- data/lib/rgeo/all.rb +5 -4
- data/lib/rgeo/cartesian.rb +3 -2
- data/lib/rgeo/cartesian/bounding_box.rb +9 -9
- data/lib/rgeo/cartesian/factory.rb +30 -13
- data/lib/rgeo/cartesian/feature_classes.rb +33 -33
- data/lib/rgeo/cartesian/interface.rb +2 -2
- data/lib/rgeo/{geography/all.rb → coord_sys.rb} +22 -4
- data/lib/rgeo/coord_sys/proj4.rb +275 -0
- data/lib/rgeo/{errors.rb → error.rb} +5 -6
- data/lib/rgeo/{features.rb → feature.rb} +22 -20
- data/lib/rgeo/{features → feature}/curve.rb +6 -6
- data/lib/rgeo/{features → feature}/factory.rb +19 -3
- data/lib/rgeo/{features → feature}/factory_generator.rb +1 -1
- data/lib/rgeo/{features → feature}/geometry.rb +34 -34
- data/lib/rgeo/{features → feature}/geometry_collection.rb +4 -4
- data/lib/rgeo/{features → feature}/line.rb +1 -1
- data/lib/rgeo/{features → feature}/line_string.rb +4 -4
- data/lib/rgeo/{features → feature}/linear_ring.rb +1 -1
- data/lib/rgeo/{features → feature}/multi_curve.rb +3 -3
- data/lib/rgeo/{features → feature}/multi_line_string.rb +1 -1
- data/lib/rgeo/{features → feature}/multi_point.rb +1 -1
- data/lib/rgeo/{features → feature}/multi_polygon.rb +1 -1
- data/lib/rgeo/{features → feature}/multi_surface.rb +4 -4
- data/lib/rgeo/{features → feature}/point.rb +5 -5
- data/lib/rgeo/{features → feature}/polygon.rb +5 -5
- data/lib/rgeo/{features → feature}/surface.rb +4 -4
- data/lib/rgeo/feature/types.rb +301 -0
- data/lib/rgeo/geo_json.rb +1 -1
- data/lib/rgeo/geo_json/coder.rb +13 -13
- data/lib/rgeo/geo_json/interface.rb +2 -2
- data/lib/rgeo/geography.rb +33 -6
- data/lib/rgeo/geography/factory.rb +82 -39
- data/lib/rgeo/geography/interface.rb +135 -89
- data/lib/rgeo/geography/proj4_projector.rb +98 -0
- data/lib/rgeo/geography/projected_feature_classes.rb +213 -0
- data/lib/rgeo/geography/projected_feature_methods.rb +228 -0
- data/lib/rgeo/geography/projected_window.rb +7 -7
- data/lib/rgeo/geography/simple_mercator_projector.rb +133 -0
- data/lib/rgeo/geography/spherical_feature_classes.rb +212 -0
- data/lib/rgeo/geography/{simple_spherical/feature_methods.rb → spherical_feature_methods.rb} +39 -43
- data/lib/rgeo/geography/{simple_spherical/calculations.rb → spherical_math.rb} +7 -7
- data/lib/rgeo/geos.rb +1 -1
- data/lib/rgeo/geos/factory.rb +37 -19
- data/lib/rgeo/geos/impl_additions.rb +10 -11
- data/lib/rgeo/geos/interface.rb +1 -1
- data/lib/rgeo/geos/zm_factory.rb +15 -15
- data/lib/rgeo/geos/zm_impl.rb +10 -10
- data/lib/rgeo/{impl_helpers.rb → impl_helper.rb} +8 -8
- data/lib/rgeo/{impl_helpers → impl_helper}/basic_geometry_collection_methods.rb +13 -13
- data/lib/rgeo/{impl_helpers → impl_helper}/basic_geometry_methods.rb +2 -2
- data/lib/rgeo/{impl_helpers → impl_helper}/basic_line_string_methods.rb +13 -13
- data/lib/rgeo/{impl_helpers → impl_helper}/basic_point_methods.rb +5 -5
- data/lib/rgeo/{impl_helpers → impl_helper}/basic_polygon_methods.rb +6 -6
- data/lib/rgeo/{impl_helpers → impl_helper}/math.rb +1 -1
- data/lib/rgeo/shapefile.rb +1 -1
- data/lib/rgeo/shapefile/reader.rb +3 -3
- data/lib/rgeo/wkrep.rb +1 -1
- data/lib/rgeo/wkrep/wkb_generator.rb +17 -17
- data/lib/rgeo/wkrep/wkb_parser.rb +12 -12
- data/lib/rgeo/wkrep/wkt_generator.rb +8 -8
- data/lib/rgeo/wkrep/wkt_parser.rb +10 -10
- data/{tests → test}/active_record/readme.txt +0 -0
- data/{tests → test}/active_record/tc_mysqlspatial.rb +2 -2
- data/{tests → test}/common/geometry_collection_tests.rb +22 -22
- data/{tests → test}/common/line_string_tests.rb +20 -20
- data/{tests → test}/common/multi_line_string_tests.rb +19 -19
- data/{tests → test}/common/multi_point_tests.rb +17 -17
- data/{tests → test}/common/multi_polygon_tests.rb +16 -16
- data/{tests → test}/common/point_tests.rb +9 -9
- data/{tests → test}/common/polygon_tests.rb +9 -9
- data/test/coord_sys/tc_proj4.rb +111 -0
- data/{tests → test}/geos/tc_factory.rb +1 -1
- data/{tests → test}/geos/tc_geometry_collection.rb +1 -1
- data/{tests → test}/geos/tc_line_string.rb +0 -0
- data/{tests → test}/geos/tc_misc.rb +1 -1
- data/{tests → test}/geos/tc_multi_line_string.rb +1 -1
- data/{tests → test}/geos/tc_multi_point.rb +1 -1
- data/{tests → test}/geos/tc_multi_polygon.rb +1 -1
- data/{tests → test}/geos/tc_point.rb +1 -1
- data/{tests → test}/geos/tc_polygon.rb +0 -0
- data/{tests → test}/geos/tc_zmfactory.rb +2 -2
- data/test/projected_geography/tc_geometry_collection.rb +62 -0
- data/test/projected_geography/tc_line_string.rb +62 -0
- data/test/projected_geography/tc_multi_line_string.rb +62 -0
- data/test/projected_geography/tc_multi_point.rb +62 -0
- data/test/projected_geography/tc_multi_polygon.rb +63 -0
- data/test/projected_geography/tc_point.rb +93 -0
- data/test/projected_geography/tc_polygon.rb +62 -0
- data/{tests → test}/shapefile/shapelib_testcases/readme.txt +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test.dbf +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test.shx +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test0.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test0.shx +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test1.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test1.shx +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test10.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test10.shx +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test11.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test11.shx +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test12.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test12.shx +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test13.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test13.shx +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test2.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test2.shx +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test3.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test3.shx +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test4.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test4.shx +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test5.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test5.shx +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test6.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test6.shx +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test7.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test7.shx +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test8.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test8.shx +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test9.shp +0 -0
- data/{tests → test}/shapefile/shapelib_testcases/test9.shx +0 -0
- data/{tests → test}/shapefile/tc_shapelib_tests.rb +17 -17
- data/{tests → test}/simple_cartesian/tc_calculations.rb +0 -0
- data/{tests → test}/simple_cartesian/tc_geometry_collection.rb +0 -0
- data/{tests → test}/simple_cartesian/tc_line_string.rb +0 -0
- data/{tests → test}/simple_cartesian/tc_multi_line_string.rb +0 -0
- data/{tests → test}/simple_cartesian/tc_multi_point.rb +0 -0
- data/{tests → test}/simple_cartesian/tc_multi_polygon.rb +0 -0
- data/{tests → test}/simple_cartesian/tc_point.rb +0 -0
- data/{tests → test}/simple_cartesian/tc_polygon.rb +0 -0
- data/{tests → test}/simple_mercator/tc_geometry_collection.rb +1 -1
- data/{tests → test}/simple_mercator/tc_line_string.rb +0 -0
- data/{tests → test}/simple_mercator/tc_multi_line_string.rb +1 -1
- data/{tests → test}/simple_mercator/tc_multi_point.rb +1 -1
- data/{tests → test}/simple_mercator/tc_multi_polygon.rb +1 -1
- data/{tests → test}/simple_mercator/tc_point.rb +2 -2
- data/{tests → test}/simple_mercator/tc_polygon.rb +0 -0
- data/{tests → test}/simple_mercator/tc_window.rb +1 -1
- data/test/spherical_geography/tc_calculations.rb +203 -0
- data/{tests/simple_spherical → test/spherical_geography}/tc_geometry_collection.rb +2 -2
- data/{tests/simple_spherical → test/spherical_geography}/tc_line_string.rb +2 -2
- data/{tests/simple_spherical → test/spherical_geography}/tc_multi_line_string.rb +2 -2
- data/{tests/simple_spherical → test/spherical_geography}/tc_multi_point.rb +2 -2
- data/{tests/simple_spherical → test/spherical_geography}/tc_multi_polygon.rb +3 -3
- data/{tests/simple_spherical → test/spherical_geography}/tc_point.rb +7 -7
- data/{tests/simple_spherical → test/spherical_geography}/tc_polygon.rb +2 -2
- data/{tests → test}/tc_cartesian_analysis.rb +0 -0
- data/{tests → test}/tc_geojson.rb +0 -0
- data/{tests → test}/tc_oneoff.rb +2 -1
- data/{tests → test}/wkrep/tc_wkb_generator.rb +0 -0
- data/{tests → test}/wkrep/tc_wkb_parser.rb +32 -32
- data/{tests → test}/wkrep/tc_wkt_generator.rb +0 -0
- data/{tests → test}/wkrep/tc_wkt_parser.rb +46 -46
- metadata +183 -164
- data/lib/rgeo/features/types.rb +0 -272
- data/lib/rgeo/geography/simple_mercator/feature_classes.rb +0 -279
- data/lib/rgeo/geography/simple_mercator/feature_methods.rb +0 -278
- data/lib/rgeo/geography/simple_mercator/projector.rb +0 -112
- data/lib/rgeo/geography/simple_spherical.rb +0 -68
- data/lib/rgeo/geography/simple_spherical/feature_classes.rb +0 -216
- data/tests/simple_spherical/tc_calculations.rb +0 -203
data/{tests → test}/tc_oneoff.rb
RENAMED
@@ -46,7 +46,8 @@ module RGeo
|
|
46
46
|
|
47
47
|
def setup
|
48
48
|
@mercator_factory = ::RGeo::Geography.simple_mercator
|
49
|
-
@spherical_factory = ::RGeo::Geography.
|
49
|
+
@spherical_factory = ::RGeo::Geography.spherical(:support_z_coordinate => true)
|
50
|
+
@projected_factory = ::RGeo::Geography.projected(:projection_proj4 => '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs', :projection_srid => 3857, :support_z_coordinate => true)
|
50
51
|
@geos_factory = ::RGeo::Geos.factory(:srid => 4326, :support_z_coordinate => true)
|
51
52
|
@cartesian_factory = ::RGeo::Cartesian.simple_factory(:srid => 1, :support_z_coordinate => true)
|
52
53
|
@entity_factory = ::RGeo::GeoJSON::EntityFactory.instance
|
File without changes
|
@@ -48,7 +48,7 @@ module RGeo
|
|
48
48
|
def test_point_2d_xdr
|
49
49
|
parser_ = ::RGeo::WKRep::WKBParser.new
|
50
50
|
obj_ = parser_.parse_hex('00000000013ff00000000000004000000000000000')
|
51
|
-
assert_equal(::RGeo::
|
51
|
+
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
52
52
|
assert_equal(1, obj_.x)
|
53
53
|
assert_equal(2, obj_.y)
|
54
54
|
end
|
@@ -57,7 +57,7 @@ module RGeo
|
|
57
57
|
def test_point_2d_ndr
|
58
58
|
parser_ = ::RGeo::WKRep::WKBParser.new
|
59
59
|
obj_ = parser_.parse_hex('0101000000000000000000f03f0000000000000040')
|
60
|
-
assert_equal(::RGeo::
|
60
|
+
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
61
61
|
assert_equal(1, obj_.x)
|
62
62
|
assert_equal(2, obj_.y)
|
63
63
|
end
|
@@ -67,7 +67,7 @@ module RGeo
|
|
67
67
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true)
|
68
68
|
parser_ = ::RGeo::WKRep::WKBParser.new(:default_factory => factory_, :support_ewkb => true)
|
69
69
|
obj_ = parser_.parse_hex('00800000013ff000000000000040000000000000004008000000000000')
|
70
|
-
assert_equal(::RGeo::
|
70
|
+
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
71
71
|
assert_equal(3, obj_.z)
|
72
72
|
assert_nil(obj_.m)
|
73
73
|
end
|
@@ -77,7 +77,7 @@ module RGeo
|
|
77
77
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_m_coordinate => true)
|
78
78
|
parser_ = ::RGeo::WKRep::WKBParser.new(:default_factory => factory_, :support_ewkb => true)
|
79
79
|
obj_ = parser_.parse_hex('00400000013ff000000000000040000000000000004008000000000000')
|
80
|
-
assert_equal(::RGeo::
|
80
|
+
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
81
81
|
assert_equal(3, obj_.m)
|
82
82
|
assert_nil(obj_.z)
|
83
83
|
end
|
@@ -87,7 +87,7 @@ module RGeo
|
|
87
87
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true, :support_m_coordinate => true)
|
88
88
|
parser_ = ::RGeo::WKRep::WKBParser.new(:default_factory => factory_, :support_ewkb => true)
|
89
89
|
obj_ = parser_.parse_hex('00c00000013ff0000000000000400000000000000040080000000000004010000000000000')
|
90
|
-
assert_equal(::RGeo::
|
90
|
+
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
91
91
|
assert_equal(3, obj_.z)
|
92
92
|
assert_equal(4, obj_.m)
|
93
93
|
end
|
@@ -97,7 +97,7 @@ module RGeo
|
|
97
97
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true)
|
98
98
|
parser_ = ::RGeo::WKRep::WKBParser.new(:default_factory => factory_, :support_wkb12 => true)
|
99
99
|
obj_ = parser_.parse_hex('00000003e93ff000000000000040000000000000004008000000000000')
|
100
|
-
assert_equal(::RGeo::
|
100
|
+
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
101
101
|
assert_equal(3, obj_.z)
|
102
102
|
assert_nil(obj_.m)
|
103
103
|
end
|
@@ -107,7 +107,7 @@ module RGeo
|
|
107
107
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_m_coordinate => true)
|
108
108
|
parser_ = ::RGeo::WKRep::WKBParser.new(:default_factory => factory_, :support_wkb12 => true)
|
109
109
|
obj_ = parser_.parse_hex('00000007d13ff000000000000040000000000000004008000000000000')
|
110
|
-
assert_equal(::RGeo::
|
110
|
+
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
111
111
|
assert_equal(3, obj_.m)
|
112
112
|
assert_nil(obj_.z)
|
113
113
|
end
|
@@ -117,7 +117,7 @@ module RGeo
|
|
117
117
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true, :support_m_coordinate => true)
|
118
118
|
parser_ = ::RGeo::WKRep::WKBParser.new(:default_factory => factory_, :support_wkb12 => true)
|
119
119
|
obj_ = parser_.parse_hex('0000000bb93ff0000000000000400000000000000040080000000000004010000000000000')
|
120
|
-
assert_equal(::RGeo::
|
120
|
+
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
121
121
|
assert_equal(3, obj_.z)
|
122
122
|
assert_equal(4, obj_.m)
|
123
123
|
end
|
@@ -126,7 +126,7 @@ module RGeo
|
|
126
126
|
def test_point_with_wkb12_z_without_wkb12_support
|
127
127
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true)
|
128
128
|
parser_ = ::RGeo::WKRep::WKBParser.new(:default_factory => factory_)
|
129
|
-
assert_raise(::RGeo::
|
129
|
+
assert_raise(::RGeo::Error::ParseError) do
|
130
130
|
obj_ = parser_.parse_hex('00000003e93ff000000000000040000000000000004008000000000000')
|
131
131
|
end
|
132
132
|
end
|
@@ -135,7 +135,7 @@ module RGeo
|
|
135
135
|
def test_point_with_wkb12_z_without_enough_data
|
136
136
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true)
|
137
137
|
parser_ = ::RGeo::WKRep::WKBParser.new(:default_factory => factory_, :support_wkb12 => true)
|
138
|
-
assert_raise(::RGeo::
|
138
|
+
assert_raise(::RGeo::Error::ParseError) do
|
139
139
|
obj_ = parser_.parse_hex('00000003e93ff00000000000004000000000000000')
|
140
140
|
end
|
141
141
|
end
|
@@ -148,7 +148,7 @@ module RGeo
|
|
148
148
|
::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true, :srid => config_[:srid])
|
149
149
|
end
|
150
150
|
obj_ = parser_.parse_hex('00a0000001000003e83ff000000000000040000000000000004008000000000000')
|
151
|
-
assert_equal(::RGeo::
|
151
|
+
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
152
152
|
assert_equal(3, obj_.z)
|
153
153
|
assert_nil(obj_.m)
|
154
154
|
assert_equal(1000, obj_.srid)
|
@@ -158,7 +158,7 @@ module RGeo
|
|
158
158
|
def test_linestring_basic
|
159
159
|
parser_ = ::RGeo::WKRep::WKBParser.new
|
160
160
|
obj_ = parser_.parse_hex('0000000002000000033ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000')
|
161
|
-
assert_equal(::RGeo::
|
161
|
+
assert_equal(::RGeo::Feature::LineString, obj_.geometry_type)
|
162
162
|
assert_equal(3, obj_.num_points)
|
163
163
|
assert_equal(1, obj_.point_n(0).x)
|
164
164
|
assert_equal(6, obj_.point_n(2).y)
|
@@ -169,7 +169,7 @@ module RGeo
|
|
169
169
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true)
|
170
170
|
parser_ = ::RGeo::WKRep::WKBParser.new(:default_factory => factory_, :support_ewkb => true)
|
171
171
|
obj_ = parser_.parse_hex('0080000002000000023ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000')
|
172
|
-
assert_equal(::RGeo::
|
172
|
+
assert_equal(::RGeo::Feature::LineString, obj_.geometry_type)
|
173
173
|
assert_equal(2, obj_.num_points)
|
174
174
|
assert_equal(1, obj_.point_n(0).x)
|
175
175
|
assert_equal(6, obj_.point_n(1).z)
|
@@ -183,7 +183,7 @@ module RGeo
|
|
183
183
|
::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true, :srid => config_[:srid])
|
184
184
|
end
|
185
185
|
obj_ = parser_.parse_hex('00a0000002000003e8000000023ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000')
|
186
|
-
assert_equal(::RGeo::
|
186
|
+
assert_equal(::RGeo::Feature::LineString, obj_.geometry_type)
|
187
187
|
assert_equal(2, obj_.num_points)
|
188
188
|
assert_equal(1, obj_.point_n(0).x)
|
189
189
|
assert_equal(6, obj_.point_n(1).z)
|
@@ -195,7 +195,7 @@ module RGeo
|
|
195
195
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true)
|
196
196
|
parser_ = ::RGeo::WKRep::WKBParser.new(:default_factory => factory_, :support_wkb12 => true)
|
197
197
|
obj_ = parser_.parse_hex('00000003ea000000023ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000')
|
198
|
-
assert_equal(::RGeo::
|
198
|
+
assert_equal(::RGeo::Feature::LineString, obj_.geometry_type)
|
199
199
|
assert_equal(2, obj_.num_points)
|
200
200
|
assert_equal(1, obj_.point_n(0).x)
|
201
201
|
assert_equal(6, obj_.point_n(1).z)
|
@@ -205,7 +205,7 @@ module RGeo
|
|
205
205
|
def test_linestring_empty
|
206
206
|
parser_ = ::RGeo::WKRep::WKBParser.new
|
207
207
|
obj_ = parser_.parse_hex('000000000200000000')
|
208
|
-
assert_equal(::RGeo::
|
208
|
+
assert_equal(::RGeo::Feature::LineString, obj_.geometry_type)
|
209
209
|
assert_equal(0, obj_.num_points)
|
210
210
|
end
|
211
211
|
|
@@ -213,7 +213,7 @@ module RGeo
|
|
213
213
|
def test_polygon_basic
|
214
214
|
parser_ = ::RGeo::WKRep::WKBParser.new
|
215
215
|
obj_ = parser_.parse_hex('000000000300000001000000043ff0000000000000400000000000000040080000000000004010000000000000401800000000000040140000000000003ff00000000000004000000000000000')
|
216
|
-
assert_equal(::RGeo::
|
216
|
+
assert_equal(::RGeo::Feature::Polygon, obj_.geometry_type)
|
217
217
|
assert_equal(4, obj_.exterior_ring.num_points)
|
218
218
|
assert_equal(1, obj_.exterior_ring.point_n(0).x)
|
219
219
|
assert_equal(5, obj_.exterior_ring.point_n(2).y)
|
@@ -223,7 +223,7 @@ module RGeo
|
|
223
223
|
def test_polygon_empty
|
224
224
|
parser_ = ::RGeo::WKRep::WKBParser.new
|
225
225
|
obj_ = parser_.parse_hex('000000000300000000')
|
226
|
-
assert_equal(::RGeo::
|
226
|
+
assert_equal(::RGeo::Feature::Polygon, obj_.geometry_type)
|
227
227
|
assert_equal(0, obj_.exterior_ring.num_points)
|
228
228
|
end
|
229
229
|
|
@@ -231,7 +231,7 @@ module RGeo
|
|
231
231
|
def test_multipoint_basic
|
232
232
|
parser_ = ::RGeo::WKRep::WKBParser.new
|
233
233
|
obj_ = parser_.parse_hex('00000000040000000200000000013ff00000000000004000000000000000000000000140080000000000004010000000000000')
|
234
|
-
assert_equal(::RGeo::
|
234
|
+
assert_equal(::RGeo::Feature::MultiPoint, obj_.geometry_type)
|
235
235
|
assert_equal(2, obj_.num_geometries)
|
236
236
|
assert_equal(1, obj_[0].x)
|
237
237
|
assert_equal(4, obj_[1].y)
|
@@ -241,7 +241,7 @@ module RGeo
|
|
241
241
|
def test_multipoint_mixed_byte_order
|
242
242
|
parser_ = ::RGeo::WKRep::WKBParser.new
|
243
243
|
obj_ = parser_.parse_hex('0000000004000000020101000000000000000000f03f0000000000000040000000000140080000000000004010000000000000')
|
244
|
-
assert_equal(::RGeo::
|
244
|
+
assert_equal(::RGeo::Feature::MultiPoint, obj_.geometry_type)
|
245
245
|
assert_equal(2, obj_.num_geometries)
|
246
246
|
assert_equal(1, obj_[0].x)
|
247
247
|
assert_equal(4, obj_[1].y)
|
@@ -252,7 +252,7 @@ module RGeo
|
|
252
252
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true)
|
253
253
|
parser_ = ::RGeo::WKRep::WKBParser.new(:default_factory => factory_, :support_ewkb => true)
|
254
254
|
obj_ = parser_.parse_hex('00800000040000000200800000013ff0000000000000400000000000000040140000000000000080000001400800000000000040100000000000004018000000000000')
|
255
|
-
assert_equal(::RGeo::
|
255
|
+
assert_equal(::RGeo::Feature::MultiPoint, obj_.geometry_type)
|
256
256
|
assert_equal(2, obj_.num_geometries)
|
257
257
|
assert_equal(1, obj_[0].x)
|
258
258
|
assert_equal(5, obj_[0].z)
|
@@ -265,7 +265,7 @@ module RGeo
|
|
265
265
|
def test_multipoint_ewkb_with_mixed_z
|
266
266
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true)
|
267
267
|
parser_ = ::RGeo::WKRep::WKBParser.new(:default_factory => factory_, :support_ewkb => true)
|
268
|
-
assert_raise(::RGeo::
|
268
|
+
assert_raise(::RGeo::Error::ParseError) do
|
269
269
|
obj_ = parser_.parse_hex('00800000040000000200800000013ff000000000000040000000000000004014000000000000000000000140080000000000004010000000000000')
|
270
270
|
end
|
271
271
|
end
|
@@ -274,7 +274,7 @@ module RGeo
|
|
274
274
|
def test_multipoint_empty
|
275
275
|
parser_ = ::RGeo::WKRep::WKBParser.new
|
276
276
|
obj_ = parser_.parse_hex('000000000400000000')
|
277
|
-
assert_equal(::RGeo::
|
277
|
+
assert_equal(::RGeo::Feature::MultiPoint, obj_.geometry_type)
|
278
278
|
assert_equal(0, obj_.num_geometries)
|
279
279
|
end
|
280
280
|
|
@@ -282,7 +282,7 @@ module RGeo
|
|
282
282
|
def test_multilinestring_basic
|
283
283
|
parser_ = ::RGeo::WKRep::WKBParser.new
|
284
284
|
obj_ = parser_.parse_hex('0000000005000000020000000002000000033ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000000000000200000002bff0000000000000c000000000000000c008000000000000c010000000000000')
|
285
|
-
assert_equal(::RGeo::
|
285
|
+
assert_equal(::RGeo::Feature::MultiLineString, obj_.geometry_type)
|
286
286
|
assert_equal(2, obj_.num_geometries)
|
287
287
|
assert_equal(1, obj_[0].point_n(0).x)
|
288
288
|
assert_equal(-4, obj_[1].point_n(1).y)
|
@@ -291,7 +291,7 @@ module RGeo
|
|
291
291
|
|
292
292
|
def test_multilinestring_wrong_element_type
|
293
293
|
parser_ = ::RGeo::WKRep::WKBParser.new
|
294
|
-
assert_raise(::RGeo::
|
294
|
+
assert_raise(::RGeo::Error::ParseError) do
|
295
295
|
obj_ = parser_.parse_hex('0000000005000000020000000002000000033ff00000000000004000000000000000400800000000000040100000000000004014000000000000401800000000000000000000013ff00000000000004000000000000000')
|
296
296
|
end
|
297
297
|
end
|
@@ -300,7 +300,7 @@ module RGeo
|
|
300
300
|
def test_multilinestring_empty
|
301
301
|
parser_ = ::RGeo::WKRep::WKBParser.new
|
302
302
|
obj_ = parser_.parse_hex('000000000500000000')
|
303
|
-
assert_equal(::RGeo::
|
303
|
+
assert_equal(::RGeo::Feature::MultiLineString, obj_.geometry_type)
|
304
304
|
assert_equal(0, obj_.num_geometries)
|
305
305
|
end
|
306
306
|
|
@@ -308,7 +308,7 @@ module RGeo
|
|
308
308
|
def test_multipolygon_basic
|
309
309
|
parser_ = ::RGeo::WKRep::WKBParser.new
|
310
310
|
obj_ = parser_.parse_hex('000000000600000002000000000300000001000000043ff0000000000000400000000000000040080000000000004010000000000000401800000000000040140000000000003ff00000000000004000000000000000000000000300000000')
|
311
|
-
assert_equal(::RGeo::
|
311
|
+
assert_equal(::RGeo::Feature::MultiPolygon, obj_.geometry_type)
|
312
312
|
assert_equal(2, obj_.num_geometries)
|
313
313
|
assert_equal(4, obj_[0].exterior_ring.num_points)
|
314
314
|
assert_equal(1, obj_[0].exterior_ring.point_n(0).x)
|
@@ -320,7 +320,7 @@ module RGeo
|
|
320
320
|
def test_multipolygon_empty
|
321
321
|
parser_ = ::RGeo::WKRep::WKBParser.new
|
322
322
|
obj_ = parser_.parse_hex('000000000600000000')
|
323
|
-
assert_equal(::RGeo::
|
323
|
+
assert_equal(::RGeo::Feature::MultiPolygon, obj_.geometry_type)
|
324
324
|
assert_equal(0, obj_.num_geometries)
|
325
325
|
end
|
326
326
|
|
@@ -328,12 +328,12 @@ module RGeo
|
|
328
328
|
def test_collection_basic
|
329
329
|
parser_ = ::RGeo::WKRep::WKBParser.new
|
330
330
|
obj_ = parser_.parse_hex('0000000007000000020000000002000000033ff0000000000000400000000000000040080000000000004010000000000000401400000000000040180000000000000000000001bff0000000000000c000000000000000')
|
331
|
-
assert_equal(::RGeo::
|
331
|
+
assert_equal(::RGeo::Feature::GeometryCollection, obj_.geometry_type)
|
332
332
|
assert_equal(2, obj_.num_geometries)
|
333
|
-
assert_equal(::RGeo::
|
333
|
+
assert_equal(::RGeo::Feature::LineString, obj_[0].geometry_type)
|
334
334
|
assert_equal(1, obj_[0].point_n(0).x)
|
335
335
|
assert_equal(6, obj_[0].point_n(2).y)
|
336
|
-
assert_equal(::RGeo::
|
336
|
+
assert_equal(::RGeo::Feature::Point, obj_[1].geometry_type)
|
337
337
|
assert_equal(-1, obj_[1].x)
|
338
338
|
end
|
339
339
|
|
@@ -341,7 +341,7 @@ module RGeo
|
|
341
341
|
def test_collection_empty
|
342
342
|
parser_ = ::RGeo::WKRep::WKBParser.new
|
343
343
|
obj_ = parser_.parse_hex('000000000700000000')
|
344
|
-
assert_equal(::RGeo::
|
344
|
+
assert_equal(::RGeo::Feature::GeometryCollection, obj_.geometry_type)
|
345
345
|
assert_equal(0, obj_.num_geometries)
|
346
346
|
end
|
347
347
|
|
File without changes
|
@@ -48,7 +48,7 @@ module RGeo
|
|
48
48
|
def test_point_2d
|
49
49
|
parser_ = ::RGeo::WKRep::WKTParser.new
|
50
50
|
obj_ = parser_.parse('POINT(1 2)')
|
51
|
-
assert_equal(::RGeo::
|
51
|
+
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
52
52
|
assert_equal(1, obj_.x)
|
53
53
|
assert_equal(2, obj_.y)
|
54
54
|
end
|
@@ -57,7 +57,7 @@ module RGeo
|
|
57
57
|
def test_values_fractional
|
58
58
|
parser_ = ::RGeo::WKRep::WKTParser.new
|
59
59
|
obj_ = parser_.parse('POINT(1.000 2.5)')
|
60
|
-
assert_equal(::RGeo::
|
60
|
+
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
61
61
|
assert_equal(1.0, obj_.x)
|
62
62
|
assert_equal(2.5, obj_.y)
|
63
63
|
end
|
@@ -66,7 +66,7 @@ module RGeo
|
|
66
66
|
def test_values_fractional2
|
67
67
|
parser_ = ::RGeo::WKRep::WKTParser.new
|
68
68
|
obj_ = parser_.parse('POINT(1. .5)')
|
69
|
-
assert_equal(::RGeo::
|
69
|
+
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
70
70
|
assert_equal(1.0, obj_.x)
|
71
71
|
assert_equal(0.5, obj_.y)
|
72
72
|
end
|
@@ -76,7 +76,7 @@ module RGeo
|
|
76
76
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true)
|
77
77
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_)
|
78
78
|
obj_ = parser_.parse('POINT(-1. -.5 -5.5)')
|
79
|
-
assert_equal(::RGeo::
|
79
|
+
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
80
80
|
assert_equal(-1.0, obj_.x)
|
81
81
|
assert_equal(-0.5, obj_.y)
|
82
82
|
assert_equal(-5.5, obj_.z)
|
@@ -86,7 +86,7 @@ module RGeo
|
|
86
86
|
def test_point_square_brackets
|
87
87
|
parser_ = ::RGeo::WKRep::WKTParser.new
|
88
88
|
obj_ = parser_.parse('POINT[1 2]')
|
89
|
-
assert_equal(::RGeo::
|
89
|
+
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
90
90
|
assert_equal(1, obj_.x)
|
91
91
|
assert_equal(2, obj_.y)
|
92
92
|
end
|
@@ -95,7 +95,7 @@ module RGeo
|
|
95
95
|
def test_point_empty
|
96
96
|
parser_ = ::RGeo::WKRep::WKTParser.new
|
97
97
|
obj_ = parser_.parse('POINT EMPTY')
|
98
|
-
assert_equal(::RGeo::
|
98
|
+
assert_equal(::RGeo::Feature::MultiPoint, obj_.geometry_type)
|
99
99
|
assert_equal(0, obj_.num_geometries)
|
100
100
|
end
|
101
101
|
|
@@ -104,7 +104,7 @@ module RGeo
|
|
104
104
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true)
|
105
105
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_)
|
106
106
|
obj_ = parser_.parse('POINT(1 2 3)')
|
107
|
-
assert_equal(::RGeo::
|
107
|
+
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
108
108
|
assert_equal(3, obj_.z)
|
109
109
|
assert_nil(obj_.m)
|
110
110
|
end
|
@@ -114,7 +114,7 @@ module RGeo
|
|
114
114
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_m_coordinate => true)
|
115
115
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_)
|
116
116
|
obj_ = parser_.parse('POINT(1 2 3)')
|
117
|
-
assert_equal(::RGeo::
|
117
|
+
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
118
118
|
assert_equal(3, obj_.m)
|
119
119
|
assert_nil(obj_.z)
|
120
120
|
end
|
@@ -123,7 +123,7 @@ module RGeo
|
|
123
123
|
def test_point_with_too_many_coords
|
124
124
|
factory_ = ::RGeo::Cartesian.preferred_factory
|
125
125
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_)
|
126
|
-
assert_raise(::RGeo::
|
126
|
+
assert_raise(::RGeo::Error::ParseError) do
|
127
127
|
obj_ = parser_.parse('POINT(1 2 3)')
|
128
128
|
end
|
129
129
|
end
|
@@ -133,7 +133,7 @@ module RGeo
|
|
133
133
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true)
|
134
134
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_, :support_wkt12 => true)
|
135
135
|
obj_ = parser_.parse('POINT Z(1 2 3)')
|
136
|
-
assert_equal(::RGeo::
|
136
|
+
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
137
137
|
assert_equal(3, obj_.z)
|
138
138
|
assert_nil(obj_.m)
|
139
139
|
end
|
@@ -142,7 +142,7 @@ module RGeo
|
|
142
142
|
def test_point_wkt12_z_unsupported_factory
|
143
143
|
factory_ = ::RGeo::Cartesian.preferred_factory
|
144
144
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_, :support_wkt12 => true)
|
145
|
-
assert_raise(::RGeo::
|
145
|
+
assert_raise(::RGeo::Error::ParseError) do
|
146
146
|
obj_ = parser_.parse('POINT Z(1 2 3)')
|
147
147
|
end
|
148
148
|
end
|
@@ -152,7 +152,7 @@ module RGeo
|
|
152
152
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_m_coordinate => true)
|
153
153
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_, :support_wkt12 => true)
|
154
154
|
obj_ = parser_.parse('POINT M(1 2 3)')
|
155
|
-
assert_equal(::RGeo::
|
155
|
+
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
156
156
|
assert_equal(3, obj_.m)
|
157
157
|
assert_nil(obj_.z)
|
158
158
|
end
|
@@ -162,7 +162,7 @@ module RGeo
|
|
162
162
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true, :support_m_coordinate => true)
|
163
163
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_, :support_wkt12 => true)
|
164
164
|
obj_ = parser_.parse('POINT M(1 2 3)')
|
165
|
-
assert_equal(::RGeo::
|
165
|
+
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
166
166
|
assert_equal(3, obj_.m)
|
167
167
|
assert_equal(0, obj_.z)
|
168
168
|
end
|
@@ -171,7 +171,7 @@ module RGeo
|
|
171
171
|
def test_point_wkt12_m_too_many_coords
|
172
172
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_m_coordinate => true)
|
173
173
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_, :support_wkt12 => true)
|
174
|
-
assert_raise(::RGeo::
|
174
|
+
assert_raise(::RGeo::Error::ParseError) do
|
175
175
|
obj_ = parser_.parse('POINT M(1 2 3 4)')
|
176
176
|
end
|
177
177
|
end
|
@@ -181,7 +181,7 @@ module RGeo
|
|
181
181
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true, :support_m_coordinate => true)
|
182
182
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_, :support_wkt12 => true)
|
183
183
|
obj_ = parser_.parse('POINT ZM(1 2 3 4)')
|
184
|
-
assert_equal(::RGeo::
|
184
|
+
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
185
185
|
assert_equal(3, obj_.z)
|
186
186
|
assert_equal(4, obj_.m)
|
187
187
|
end
|
@@ -190,7 +190,7 @@ module RGeo
|
|
190
190
|
def test_point_wkt12_zm_not_enough_coords
|
191
191
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true, :support_m_coordinate => true)
|
192
192
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_, :support_wkt12 => true)
|
193
|
-
assert_raise(::RGeo::
|
193
|
+
assert_raise(::RGeo::Error::ParseError) do
|
194
194
|
obj_ = parser_.parse('POINT ZM(1 2 3)')
|
195
195
|
end
|
196
196
|
end
|
@@ -200,7 +200,7 @@ module RGeo
|
|
200
200
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true)
|
201
201
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_, :support_ewkt => true)
|
202
202
|
obj_ = parser_.parse('POINT(1 2 3)')
|
203
|
-
assert_equal(::RGeo::
|
203
|
+
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
204
204
|
assert_equal(3, obj_.z)
|
205
205
|
assert_nil(obj_.m)
|
206
206
|
end
|
@@ -210,7 +210,7 @@ module RGeo
|
|
210
210
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_m_coordinate => true)
|
211
211
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_, :support_ewkt => true)
|
212
212
|
obj_ = parser_.parse('POINTM(1 2 3)')
|
213
|
-
assert_equal(::RGeo::
|
213
|
+
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
214
214
|
assert_equal(3, obj_.m)
|
215
215
|
assert_nil(obj_.z)
|
216
216
|
end
|
@@ -223,7 +223,7 @@ module RGeo
|
|
223
223
|
::RGeo::Cartesian.preferred_factory(:support_m_coordinate => true, :srid => config_[:srid])
|
224
224
|
end
|
225
225
|
obj_ = parser_.parse('SRID=1000;POINTM(1 2 3)')
|
226
|
-
assert_equal(::RGeo::
|
226
|
+
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
227
227
|
assert_equal(3, obj_.m)
|
228
228
|
assert_nil(obj_.z)
|
229
229
|
assert_equal(1000, obj_.srid)
|
@@ -233,7 +233,7 @@ module RGeo
|
|
233
233
|
def test_point_ewkt_m_too_many_coords
|
234
234
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_m_coordinate => true)
|
235
235
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_, :support_ewkt => true)
|
236
|
-
assert_raise(::RGeo::
|
236
|
+
assert_raise(::RGeo::Error::ParseError) do
|
237
237
|
obj_ = parser_.parse('POINTM(1 2 3 4)')
|
238
238
|
end
|
239
239
|
end
|
@@ -242,7 +242,7 @@ module RGeo
|
|
242
242
|
def test_point_strict_wkt11_with_z
|
243
243
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true)
|
244
244
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_, :strict_wkt11 => true)
|
245
|
-
assert_raise(::RGeo::
|
245
|
+
assert_raise(::RGeo::Error::ParseError) do
|
246
246
|
obj_ = parser_.parse('POINT(1 2 3)')
|
247
247
|
end
|
248
248
|
end
|
@@ -252,7 +252,7 @@ module RGeo
|
|
252
252
|
factory_ = ::RGeo::Cartesian.preferred_factory
|
253
253
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_)
|
254
254
|
parser_.factory_generator = ::RGeo::Cartesian.method(:preferred_factory)
|
255
|
-
assert_raise(::RGeo::
|
255
|
+
assert_raise(::RGeo::Error::ParseError) do
|
256
256
|
obj_ = parser_.parse('SRID=1000;POINT(1 2)')
|
257
257
|
end
|
258
258
|
end
|
@@ -262,7 +262,7 @@ module RGeo
|
|
262
262
|
factory_ = ::RGeo::Cartesian.preferred_factory
|
263
263
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_)
|
264
264
|
obj_ = parser_.parse('LINESTRING(1 2, 3 4, 5 6)')
|
265
|
-
assert_equal(::RGeo::
|
265
|
+
assert_equal(::RGeo::Feature::LineString, obj_.geometry_type)
|
266
266
|
assert_equal(3, obj_.num_points)
|
267
267
|
assert_equal(1, obj_.point_n(0).x)
|
268
268
|
assert_equal(6, obj_.point_n(2).y)
|
@@ -273,7 +273,7 @@ module RGeo
|
|
273
273
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true)
|
274
274
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_)
|
275
275
|
obj_ = parser_.parse('LINESTRING(1 2 3, 4 5 6,7 8 9)')
|
276
|
-
assert_equal(::RGeo::
|
276
|
+
assert_equal(::RGeo::Feature::LineString, obj_.geometry_type)
|
277
277
|
assert_equal(3, obj_.num_points)
|
278
278
|
assert_equal(1, obj_.point_n(0).x)
|
279
279
|
assert_equal(9, obj_.point_n(2).z)
|
@@ -283,7 +283,7 @@ module RGeo
|
|
283
283
|
def test_linestring_with_inconsistent_coords
|
284
284
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true)
|
285
285
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_)
|
286
|
-
assert_raise(::RGeo::
|
286
|
+
assert_raise(::RGeo::Error::ParseError) do
|
287
287
|
obj_ = parser_.parse('LINESTRING(1 2 3, 4 5,7 8 9)')
|
288
288
|
end
|
289
289
|
end
|
@@ -293,7 +293,7 @@ module RGeo
|
|
293
293
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true, :support_m_coordinate => true)
|
294
294
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_, :support_wkt12 => true)
|
295
295
|
obj_ = parser_.parse('LINESTRING M(1 2 3,5 6 7)')
|
296
|
-
assert_equal(::RGeo::
|
296
|
+
assert_equal(::RGeo::Feature::LineString, obj_.geometry_type)
|
297
297
|
assert_equal(2, obj_.num_points)
|
298
298
|
assert_equal(0, obj_.point_n(0).z)
|
299
299
|
assert_equal(3, obj_.point_n(0).m)
|
@@ -309,7 +309,7 @@ module RGeo
|
|
309
309
|
::RGeo::Cartesian.preferred_factory(:support_m_coordinate => true, :srid => config_[:srid])
|
310
310
|
end
|
311
311
|
obj_ = parser_.parse('SRID=1000;LINESTRINGM(1 2 3, 4 5 6)')
|
312
|
-
assert_equal(::RGeo::
|
312
|
+
assert_equal(::RGeo::Feature::LineString, obj_.geometry_type)
|
313
313
|
assert_equal(3, obj_.point_n(0).m)
|
314
314
|
assert_nil(obj_.point_n(0).z)
|
315
315
|
assert_equal(1000, obj_.srid)
|
@@ -320,7 +320,7 @@ module RGeo
|
|
320
320
|
factory_ = ::RGeo::Cartesian.preferred_factory
|
321
321
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_)
|
322
322
|
obj_ = parser_.parse('LINESTRING EMPTY')
|
323
|
-
assert_equal(::RGeo::
|
323
|
+
assert_equal(::RGeo::Feature::LineString, obj_.geometry_type)
|
324
324
|
assert_equal(0, obj_.num_points)
|
325
325
|
end
|
326
326
|
|
@@ -329,7 +329,7 @@ module RGeo
|
|
329
329
|
factory_ = ::RGeo::Cartesian.preferred_factory
|
330
330
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_)
|
331
331
|
obj_ = parser_.parse('POLYGON((1 2, 3 4, 5 6, 1 2))')
|
332
|
-
assert_equal(::RGeo::
|
332
|
+
assert_equal(::RGeo::Feature::Polygon, obj_.geometry_type)
|
333
333
|
assert_equal(4, obj_.exterior_ring.num_points)
|
334
334
|
assert_equal(1, obj_.exterior_ring.point_n(0).x)
|
335
335
|
assert_equal(6, obj_.exterior_ring.point_n(2).y)
|
@@ -340,7 +340,7 @@ module RGeo
|
|
340
340
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true)
|
341
341
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_)
|
342
342
|
obj_ = parser_.parse('POLYGON((0 0 -1, 10 0 -2, 10 10 -3, 0 10 -4, 0 0 -5),(1 1 -6, 2 3 -7, 3 1 -8, 1 1 -9))')
|
343
|
-
assert_equal(::RGeo::
|
343
|
+
assert_equal(::RGeo::Feature::Polygon, obj_.geometry_type)
|
344
344
|
assert_equal(5, obj_.exterior_ring.num_points)
|
345
345
|
assert_equal(0, obj_.exterior_ring.point_n(0).x)
|
346
346
|
assert_equal(10, obj_.exterior_ring.point_n(2).y)
|
@@ -354,7 +354,7 @@ module RGeo
|
|
354
354
|
factory_ = ::RGeo::Cartesian.preferred_factory
|
355
355
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_)
|
356
356
|
obj_ = parser_.parse('POLYGON EMPTY')
|
357
|
-
assert_equal(::RGeo::
|
357
|
+
assert_equal(::RGeo::Feature::Polygon, obj_.geometry_type)
|
358
358
|
assert_equal(0, obj_.exterior_ring.num_points)
|
359
359
|
end
|
360
360
|
|
@@ -363,7 +363,7 @@ module RGeo
|
|
363
363
|
factory_ = ::RGeo::Cartesian.preferred_factory
|
364
364
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_)
|
365
365
|
obj_ = parser_.parse('MULTIPOINT((1 2),(0 3))')
|
366
|
-
assert_equal(::RGeo::
|
366
|
+
assert_equal(::RGeo::Feature::MultiPoint, obj_.geometry_type)
|
367
367
|
assert_equal(2, obj_.num_geometries)
|
368
368
|
assert_equal(1, obj_[0].x)
|
369
369
|
assert_equal(3, obj_[1].y)
|
@@ -374,7 +374,7 @@ module RGeo
|
|
374
374
|
factory_ = ::RGeo::Cartesian.preferred_factory
|
375
375
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_)
|
376
376
|
obj_ = parser_.parse('MULTIPOINT EMPTY')
|
377
|
-
assert_equal(::RGeo::
|
377
|
+
assert_equal(::RGeo::Feature::MultiPoint, obj_.geometry_type)
|
378
378
|
assert_equal(0, obj_.num_geometries)
|
379
379
|
end
|
380
380
|
|
@@ -383,7 +383,7 @@ module RGeo
|
|
383
383
|
factory_ = ::RGeo::Cartesian.preferred_factory
|
384
384
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_)
|
385
385
|
obj_ = parser_.parse('MULTILINESTRING((1 2, 3 4, 5 6),(0 -3, 0 -4, 1 -5))')
|
386
|
-
assert_equal(::RGeo::
|
386
|
+
assert_equal(::RGeo::Feature::MultiLineString, obj_.geometry_type)
|
387
387
|
assert_equal(2, obj_.num_geometries)
|
388
388
|
assert_equal(1, obj_[0].point_n(0).x)
|
389
389
|
assert_equal(-5, obj_[1].point_n(2).y)
|
@@ -394,7 +394,7 @@ module RGeo
|
|
394
394
|
factory_ = ::RGeo::Cartesian.preferred_factory
|
395
395
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_)
|
396
396
|
obj_ = parser_.parse('MULTILINESTRING EMPTY')
|
397
|
-
assert_equal(::RGeo::
|
397
|
+
assert_equal(::RGeo::Feature::MultiLineString, obj_.geometry_type)
|
398
398
|
assert_equal(0, obj_.num_geometries)
|
399
399
|
end
|
400
400
|
|
@@ -403,7 +403,7 @@ module RGeo
|
|
403
403
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true)
|
404
404
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_)
|
405
405
|
obj_ = parser_.parse('MULTIPOLYGON(((-1 -2 0, -3 -4 0, -5 -6 0, -1 -2 0)),((0 0 -1, 10 0 -2, 10 10 -3, 0 10 -4, 0 0 -5),(1 1 -6, 2 3 -7, 3 1 -8, 1 1 -9)))')
|
406
|
-
assert_equal(::RGeo::
|
406
|
+
assert_equal(::RGeo::Feature::MultiPolygon, obj_.geometry_type)
|
407
407
|
assert_equal(2, obj_.num_geometries)
|
408
408
|
assert_equal(4, obj_[0].exterior_ring.num_points)
|
409
409
|
assert_equal(-1, obj_[0].exterior_ring.point_n(0).x)
|
@@ -421,7 +421,7 @@ module RGeo
|
|
421
421
|
factory_ = ::RGeo::Cartesian.preferred_factory
|
422
422
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_)
|
423
423
|
obj_ = parser_.parse('MULTIPOLYGON EMPTY')
|
424
|
-
assert_equal(::RGeo::
|
424
|
+
assert_equal(::RGeo::Feature::MultiPolygon, obj_.geometry_type)
|
425
425
|
assert_equal(0, obj_.num_geometries)
|
426
426
|
end
|
427
427
|
|
@@ -430,11 +430,11 @@ module RGeo
|
|
430
430
|
factory_ = ::RGeo::Cartesian.preferred_factory
|
431
431
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_)
|
432
432
|
obj_ = parser_.parse('GEOMETRYCOLLECTION(POINT(-1 -2),LINESTRING(1 2, 3 4, 5 6))')
|
433
|
-
assert_equal(::RGeo::
|
433
|
+
assert_equal(::RGeo::Feature::GeometryCollection, obj_.geometry_type)
|
434
434
|
assert_equal(2, obj_.num_geometries)
|
435
|
-
assert_equal(::RGeo::
|
435
|
+
assert_equal(::RGeo::Feature::Point, obj_[0].geometry_type)
|
436
436
|
assert_equal(-1, obj_[0].x)
|
437
|
-
assert_equal(::RGeo::
|
437
|
+
assert_equal(::RGeo::Feature::LineString, obj_[1].geometry_type)
|
438
438
|
assert_equal(1, obj_[1].point_n(0).x)
|
439
439
|
assert_equal(6, obj_[1].point_n(2).y)
|
440
440
|
end
|
@@ -444,11 +444,11 @@ module RGeo
|
|
444
444
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true)
|
445
445
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_)
|
446
446
|
obj_ = parser_.parse('GEOMETRYCOLLECTION(POINT(-1 -2 0),LINESTRING(1 2 0, 3 4 0, 5 6 0))')
|
447
|
-
assert_equal(::RGeo::
|
447
|
+
assert_equal(::RGeo::Feature::GeometryCollection, obj_.geometry_type)
|
448
448
|
assert_equal(2, obj_.num_geometries)
|
449
|
-
assert_equal(::RGeo::
|
449
|
+
assert_equal(::RGeo::Feature::Point, obj_[0].geometry_type)
|
450
450
|
assert_equal(-1, obj_[0].x)
|
451
|
-
assert_equal(::RGeo::
|
451
|
+
assert_equal(::RGeo::Feature::LineString, obj_[1].geometry_type)
|
452
452
|
assert_equal(1, obj_[1].point_n(0).x)
|
453
453
|
assert_equal(6, obj_[1].point_n(2).y)
|
454
454
|
end
|
@@ -457,7 +457,7 @@ module RGeo
|
|
457
457
|
def test_collection_dimension_mismatch
|
458
458
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true)
|
459
459
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_)
|
460
|
-
assert_raise(::RGeo::
|
460
|
+
assert_raise(::RGeo::Error::ParseError) do
|
461
461
|
obj_ = parser_.parse('GEOMETRYCOLLECTION(POINT(-1 -2),LINESTRING(1 2 0, 3 4 0, 5 6 0))')
|
462
462
|
end
|
463
463
|
end
|
@@ -466,7 +466,7 @@ module RGeo
|
|
466
466
|
def test_collection_wkt12_type_mismatch
|
467
467
|
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true, :support_m_coordinate => true)
|
468
468
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_, :support_wkt12 => true)
|
469
|
-
assert_raise(::RGeo::
|
469
|
+
assert_raise(::RGeo::Error::ParseError) do
|
470
470
|
obj_ = parser_.parse('GEOMETRYCOLLECTION Z(POINT Z(-1 -2 0),LINESTRING M(1 2 0, 3 4 0, 5 6 0))')
|
471
471
|
end
|
472
472
|
end
|
@@ -476,7 +476,7 @@ module RGeo
|
|
476
476
|
factory_ = ::RGeo::Cartesian.preferred_factory
|
477
477
|
parser_ = ::RGeo::WKRep::WKTParser.new(:default_factory => factory_)
|
478
478
|
obj_ = parser_.parse('GEOMETRYCOLLECTION EMPTY')
|
479
|
-
assert_equal(::RGeo::
|
479
|
+
assert_equal(::RGeo::Feature::GeometryCollection, obj_.geometry_type)
|
480
480
|
assert_equal(0, obj_.num_geometries)
|
481
481
|
end
|
482
482
|
|