rgeo 0.1.21 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.rdoc +11 -0
- data/README.rdoc +1 -1
- data/Spatial_Programming_With_RGeo.rdoc +382 -0
- data/Version +1 -1
- data/lib/active_record/connection_adapters/postgis_adapter.rb +1 -1
- data/lib/rgeo.rb +4 -4
- data/lib/rgeo/active_record/base_modifications.rb +1 -1
- data/lib/rgeo/all.rb +1 -1
- data/lib/rgeo/cartesian/bounding_box.rb +2 -2
- data/lib/rgeo/cartesian/factory.rb +18 -11
- data/lib/rgeo/cartesian/interface.rb +4 -4
- data/lib/rgeo/coord_sys.rb +8 -1
- data/lib/rgeo/coord_sys/proj4.rb +4 -4
- data/lib/rgeo/feature/factory.rb +68 -49
- data/lib/rgeo/feature/factory_generator.rb +2 -2
- data/lib/rgeo/feature/types.rb +4 -4
- data/lib/rgeo/geo_json/coder.rb +5 -5
- data/lib/rgeo/{geography.rb → geographic.rb} +15 -15
- data/lib/rgeo/{geography → geographic}/factory.rb +27 -20
- data/lib/rgeo/{geography → geographic}/interface.rb +43 -29
- data/lib/rgeo/{geography → geographic}/proj4_projector.rb +2 -2
- data/lib/rgeo/{geography → geographic}/projected_feature_classes.rb +2 -2
- data/lib/rgeo/{geography → geographic}/projected_feature_methods.rb +2 -2
- data/lib/rgeo/{geography → geographic}/projected_window.rb +5 -5
- data/lib/rgeo/{geography → geographic}/simple_mercator_projector.rb +2 -2
- data/lib/rgeo/{geography → geographic}/spherical_feature_classes.rb +2 -2
- data/lib/rgeo/{geography → geographic}/spherical_feature_methods.rb +2 -2
- data/lib/rgeo/{geography → geographic}/spherical_math.rb +1 -1
- data/lib/rgeo/geos/factory.rb +22 -15
- data/lib/rgeo/geos/interface.rb +3 -3
- data/lib/rgeo/geos/zm_factory.rb +20 -6
- data/lib/rgeo/impl_helper/basic_point_methods.rb +2 -2
- data/lib/rgeo/shapefile/reader.rb +5 -5
- data/lib/rgeo/wkrep/wkb_generator.rb +2 -2
- data/lib/rgeo/wkrep/wkb_parser.rb +4 -4
- data/lib/rgeo/wkrep/wkt_generator.rb +2 -2
- data/lib/rgeo/wkrep/wkt_parser.rb +7 -7
- data/test/active_record/common_setup_methods.rb +1 -1
- data/test/geos/tc_point.rb +3 -3
- data/test/geos/tc_zmfactory.rb +7 -7
- data/test/{projected_geography → projected_geographic}/tc_geometry_collection.rb +2 -2
- data/test/{projected_geography → projected_geographic}/tc_line_string.rb +2 -2
- data/test/{projected_geography → projected_geographic}/tc_multi_line_string.rb +2 -2
- data/test/{projected_geography → projected_geographic}/tc_multi_point.rb +2 -2
- data/test/{projected_geography → projected_geographic}/tc_multi_polygon.rb +3 -3
- data/test/{projected_geography → projected_geographic}/tc_point.rb +5 -5
- data/test/{projected_geography → projected_geographic}/tc_polygon.rb +2 -2
- data/test/shapefile/tc_shapelib_tests.rb +10 -10
- data/test/simple_cartesian/tc_point.rb +3 -3
- data/test/simple_mercator/tc_geometry_collection.rb +1 -1
- data/test/simple_mercator/tc_line_string.rb +1 -1
- data/test/simple_mercator/tc_multi_line_string.rb +1 -1
- data/test/simple_mercator/tc_multi_point.rb +1 -1
- data/test/simple_mercator/tc_multi_polygon.rb +2 -2
- data/test/simple_mercator/tc_point.rb +4 -4
- data/test/simple_mercator/tc_polygon.rb +1 -1
- data/test/simple_mercator/tc_window.rb +39 -39
- data/test/spherical_geographic/tc_calculations.rb +203 -0
- data/test/{spherical_geography → spherical_geographic}/tc_geometry_collection.rb +2 -2
- data/test/{spherical_geography → spherical_geographic}/tc_line_string.rb +2 -2
- data/test/{spherical_geography → spherical_geographic}/tc_multi_line_string.rb +2 -2
- data/test/{spherical_geography → spherical_geographic}/tc_multi_point.rb +2 -2
- data/test/{spherical_geography → spherical_geographic}/tc_multi_polygon.rb +3 -3
- data/test/{spherical_geography → spherical_geographic}/tc_point.rb +6 -6
- data/test/{spherical_geography → spherical_geographic}/tc_polygon.rb +2 -2
- data/test/tc_geojson.rb +3 -3
- data/test/tc_oneoff.rb +5 -5
- data/test/wkrep/tc_wkb_generator.rb +3 -3
- data/test/wkrep/tc_wkb_parser.rb +16 -16
- data/test/wkrep/tc_wkt_generator.rb +3 -3
- data/test/wkrep/tc_wkt_parser.rb +21 -21
- metadata +46 -44
- data/test/spherical_geography/tc_calculations.rb +0 -203
@@ -42,13 +42,13 @@ require ::File.expand_path('../common/line_string_tests.rb', ::File.dirname(__FI
|
|
42
42
|
|
43
43
|
module RGeo
|
44
44
|
module Tests # :nodoc:
|
45
|
-
module
|
45
|
+
module SphericalGeographic # :nodoc:
|
46
46
|
|
47
47
|
class TestLineString < ::Test::Unit::TestCase # :nodoc:
|
48
48
|
|
49
49
|
|
50
50
|
def setup
|
51
|
-
@factory = ::RGeo::
|
51
|
+
@factory = ::RGeo::Geographic.spherical_factory
|
52
52
|
end
|
53
53
|
|
54
54
|
|
@@ -42,13 +42,13 @@ require ::File.expand_path('../common/multi_line_string_tests.rb', ::File.dirnam
|
|
42
42
|
|
43
43
|
module RGeo
|
44
44
|
module Tests # :nodoc:
|
45
|
-
module
|
45
|
+
module SphericalGeographic # :nodoc:
|
46
46
|
|
47
47
|
class TestMultiLineString < ::Test::Unit::TestCase # :nodoc:
|
48
48
|
|
49
49
|
|
50
50
|
def create_factory
|
51
|
-
@factory = ::RGeo::
|
51
|
+
@factory = ::RGeo::Geographic.spherical_factory
|
52
52
|
end
|
53
53
|
|
54
54
|
|
@@ -42,13 +42,13 @@ require ::File.expand_path('../common/multi_point_tests.rb', ::File.dirname(__FI
|
|
42
42
|
|
43
43
|
module RGeo
|
44
44
|
module Tests # :nodoc:
|
45
|
-
module
|
45
|
+
module SphericalGeographic # :nodoc:
|
46
46
|
|
47
47
|
class TestMultiPoint < ::Test::Unit::TestCase # :nodoc:
|
48
48
|
|
49
49
|
|
50
50
|
def create_factory
|
51
|
-
@factory = ::RGeo::
|
51
|
+
@factory = ::RGeo::Geographic.spherical_factory
|
52
52
|
end
|
53
53
|
|
54
54
|
|
@@ -42,14 +42,14 @@ require ::File.expand_path('../common/multi_polygon_tests.rb', ::File.dirname(__
|
|
42
42
|
|
43
43
|
module RGeo
|
44
44
|
module Tests # :nodoc:
|
45
|
-
module
|
45
|
+
module SphericalGeographic # :nodoc:
|
46
46
|
|
47
47
|
class TestMultiPolygon < ::Test::Unit::TestCase # :nodoc:
|
48
48
|
|
49
49
|
|
50
50
|
def create_factories
|
51
|
-
@factory = ::RGeo::
|
52
|
-
@lenient_factory = ::RGeo::
|
51
|
+
@factory = ::RGeo::Geographic.spherical_factory
|
52
|
+
@lenient_factory = ::RGeo::Geographic.spherical_factory(:lenient_multi_polygon_assertions => true)
|
53
53
|
end
|
54
54
|
|
55
55
|
|
@@ -42,16 +42,16 @@ require ::File.expand_path('../common/point_tests.rb', ::File.dirname(__FILE__))
|
|
42
42
|
|
43
43
|
module RGeo
|
44
44
|
module Tests # :nodoc:
|
45
|
-
module
|
45
|
+
module SphericalGeographic # :nodoc:
|
46
46
|
|
47
47
|
class TestPoint < ::Test::Unit::TestCase # :nodoc:
|
48
48
|
|
49
49
|
|
50
50
|
def setup
|
51
|
-
@factory = ::RGeo::
|
52
|
-
@zfactory = ::RGeo::
|
53
|
-
@mfactory = ::RGeo::
|
54
|
-
@zmfactory = ::RGeo::
|
51
|
+
@factory = ::RGeo::Geographic.spherical_factory
|
52
|
+
@zfactory = ::RGeo::Geographic.spherical_factory(:has_z_coordinate => true)
|
53
|
+
@mfactory = ::RGeo::Geographic.spherical_factory(:has_m_coordinate => true)
|
54
|
+
@zmfactory = ::RGeo::Geographic.spherical_factory(:has_z_coordinate => true, :has_m_coordinate => true)
|
55
55
|
end
|
56
56
|
|
57
57
|
|
@@ -76,7 +76,7 @@ module RGeo
|
|
76
76
|
point2_ = @factory.point(0, 10)
|
77
77
|
point3_ = @factory.point(0, 40)
|
78
78
|
assert_in_delta(0, point1_.distance(point2_), 0.0001)
|
79
|
-
assert_in_delta(::Math::PI / 6.0 * ::RGeo::
|
79
|
+
assert_in_delta(::Math::PI / 6.0 * ::RGeo::Geographic::SphericalMath::RADIUS, point1_.distance(point3_), 0.0001)
|
80
80
|
end
|
81
81
|
|
82
82
|
|
@@ -42,13 +42,13 @@ require ::File.expand_path('../common/polygon_tests.rb', ::File.dirname(__FILE__
|
|
42
42
|
|
43
43
|
module RGeo
|
44
44
|
module Tests # :nodoc:
|
45
|
-
module
|
45
|
+
module SphericalGeographic # :nodoc:
|
46
46
|
|
47
47
|
class TestPolygon < ::Test::Unit::TestCase # :nodoc:
|
48
48
|
|
49
49
|
|
50
50
|
def setup
|
51
|
-
@factory = ::RGeo::
|
51
|
+
@factory = ::RGeo::Geographic.spherical_factory
|
52
52
|
end
|
53
53
|
|
54
54
|
|
data/test/tc_geojson.rb
CHANGED
@@ -46,9 +46,9 @@ module RGeo
|
|
46
46
|
|
47
47
|
def setup
|
48
48
|
@geo_factory = ::RGeo::Cartesian.simple_factory(:srid => 4326)
|
49
|
-
@geo_factory_z = ::RGeo::Cartesian.simple_factory(:srid => 4326, :
|
50
|
-
@geo_factory_m = ::RGeo::Cartesian.simple_factory(:srid => 4326, :
|
51
|
-
@geo_factory_zm = ::RGeo::Cartesian.simple_factory(:srid => 4326, :
|
49
|
+
@geo_factory_z = ::RGeo::Cartesian.simple_factory(:srid => 4326, :has_z_coordinate => true)
|
50
|
+
@geo_factory_m = ::RGeo::Cartesian.simple_factory(:srid => 4326, :has_m_coordinate => true)
|
51
|
+
@geo_factory_zm = ::RGeo::Cartesian.simple_factory(:srid => 4326, :has_z_coordinate => true, :has_m_coordinate => true)
|
52
52
|
@entity_factory = ::RGeo::GeoJSON::EntityFactory.instance
|
53
53
|
end
|
54
54
|
|
data/test/tc_oneoff.rb
CHANGED
@@ -45,11 +45,11 @@ module RGeo
|
|
45
45
|
|
46
46
|
|
47
47
|
def setup
|
48
|
-
@mercator_factory = ::RGeo::
|
49
|
-
@spherical_factory = ::RGeo::
|
50
|
-
@projected_factory = ::RGeo::
|
51
|
-
@geos_factory = ::RGeo::Geos.factory(:srid => 4326, :
|
52
|
-
@cartesian_factory = ::RGeo::Cartesian.simple_factory(:srid => 1, :
|
48
|
+
@mercator_factory = ::RGeo::Geographic.simple_mercator_factory
|
49
|
+
@spherical_factory = ::RGeo::Geographic.spherical_factory(:has_z_coordinate => true)
|
50
|
+
@projected_factory = ::RGeo::Geographic.projected_factory(: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, :has_z_coordinate => true)
|
51
|
+
@geos_factory = ::RGeo::Geos.factory(:srid => 4326, :has_z_coordinate => true)
|
52
|
+
@cartesian_factory = ::RGeo::Cartesian.simple_factory(:srid => 1, :has_z_coordinate => true)
|
53
53
|
@entity_factory = ::RGeo::GeoJSON::EntityFactory.instance
|
54
54
|
end
|
55
55
|
|
@@ -47,9 +47,9 @@ module RGeo
|
|
47
47
|
|
48
48
|
def setup
|
49
49
|
@factory = ::RGeo::Cartesian.preferred_factory(:srid => 1000)
|
50
|
-
@factoryz = ::RGeo::Cartesian.preferred_factory(:srid => 1000, :
|
51
|
-
@factorym = ::RGeo::Cartesian.preferred_factory(:srid => 1000, :
|
52
|
-
@factoryzm = ::RGeo::Cartesian.preferred_factory(:srid => 1000, :
|
50
|
+
@factoryz = ::RGeo::Cartesian.preferred_factory(:srid => 1000, :has_z_coordinate => true)
|
51
|
+
@factorym = ::RGeo::Cartesian.preferred_factory(:srid => 1000, :has_m_coordinate => true)
|
52
|
+
@factoryzm = ::RGeo::Cartesian.preferred_factory(:srid => 1000, :has_z_coordinate => true, :has_m_coordinate => true)
|
53
53
|
end
|
54
54
|
|
55
55
|
|
data/test/wkrep/tc_wkb_parser.rb
CHANGED
@@ -64,7 +64,7 @@ module RGeo
|
|
64
64
|
|
65
65
|
|
66
66
|
def test_point_with_ewkb_z
|
67
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
67
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
|
68
68
|
parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_ewkb => true)
|
69
69
|
obj_ = parser_.parse_hex('00800000013ff000000000000040000000000000004008000000000000')
|
70
70
|
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
@@ -74,7 +74,7 @@ module RGeo
|
|
74
74
|
|
75
75
|
|
76
76
|
def test_point_with_ewkb_m
|
77
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
77
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_m_coordinate => true)
|
78
78
|
parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_ewkb => true)
|
79
79
|
obj_ = parser_.parse_hex('00400000013ff000000000000040000000000000004008000000000000')
|
80
80
|
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
@@ -84,7 +84,7 @@ module RGeo
|
|
84
84
|
|
85
85
|
|
86
86
|
def test_point_with_ewkb_zm
|
87
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
87
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true, :has_m_coordinate => true)
|
88
88
|
parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_ewkb => true)
|
89
89
|
obj_ = parser_.parse_hex('00c00000013ff0000000000000400000000000000040080000000000004010000000000000')
|
90
90
|
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
@@ -94,7 +94,7 @@ module RGeo
|
|
94
94
|
|
95
95
|
|
96
96
|
def test_point_with_wkb12_z
|
97
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
97
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
|
98
98
|
parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_wkb12 => true)
|
99
99
|
obj_ = parser_.parse_hex('00000003e93ff000000000000040000000000000004008000000000000')
|
100
100
|
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
@@ -104,7 +104,7 @@ module RGeo
|
|
104
104
|
|
105
105
|
|
106
106
|
def test_point_with_wkb12_m
|
107
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
107
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_m_coordinate => true)
|
108
108
|
parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_wkb12 => true)
|
109
109
|
obj_ = parser_.parse_hex('00000007d13ff000000000000040000000000000004008000000000000')
|
110
110
|
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
@@ -114,7 +114,7 @@ module RGeo
|
|
114
114
|
|
115
115
|
|
116
116
|
def test_point_with_wkb12_zm
|
117
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
117
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true, :has_m_coordinate => true)
|
118
118
|
parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_wkb12 => true)
|
119
119
|
obj_ = parser_.parse_hex('0000000bb93ff0000000000000400000000000000040080000000000004010000000000000')
|
120
120
|
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
@@ -124,7 +124,7 @@ module RGeo
|
|
124
124
|
|
125
125
|
|
126
126
|
def test_point_with_wkb12_z_without_wkb12_support
|
127
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
127
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
|
128
128
|
parser_ = ::RGeo::WKRep::WKBParser.new(factory_)
|
129
129
|
assert_raise(::RGeo::Error::ParseError) do
|
130
130
|
obj_ = parser_.parse_hex('00000003e93ff000000000000040000000000000004008000000000000')
|
@@ -133,7 +133,7 @@ module RGeo
|
|
133
133
|
|
134
134
|
|
135
135
|
def test_point_with_wkb12_z_without_enough_data
|
136
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
136
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
|
137
137
|
parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_wkb12 => true)
|
138
138
|
assert_raise(::RGeo::Error::ParseError) do
|
139
139
|
obj_ = parser_.parse_hex('00000003e93ff00000000000004000000000000000')
|
@@ -142,10 +142,10 @@ module RGeo
|
|
142
142
|
|
143
143
|
|
144
144
|
def test_point_with_ewkb_z_and_srid
|
145
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
145
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
|
146
146
|
parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_ewkb => true)
|
147
147
|
parser_.to_generate_factory do |config_|
|
148
|
-
::RGeo::Cartesian.preferred_factory(:
|
148
|
+
::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true, :srid => config_[:srid])
|
149
149
|
end
|
150
150
|
obj_ = parser_.parse_hex('00a0000001000003e83ff000000000000040000000000000004008000000000000')
|
151
151
|
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
@@ -166,7 +166,7 @@ module RGeo
|
|
166
166
|
|
167
167
|
|
168
168
|
def test_linestring_with_ewkb_z
|
169
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
169
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
|
170
170
|
parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_ewkb => true)
|
171
171
|
obj_ = parser_.parse_hex('0080000002000000023ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000')
|
172
172
|
assert_equal(::RGeo::Feature::LineString, obj_.geometry_type)
|
@@ -177,10 +177,10 @@ module RGeo
|
|
177
177
|
|
178
178
|
|
179
179
|
def test_linestring_with_ewkb_z_and_srid
|
180
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
180
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
|
181
181
|
parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_ewkb => true)
|
182
182
|
parser_.to_generate_factory do |config_|
|
183
|
-
::RGeo::Cartesian.preferred_factory(:
|
183
|
+
::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true, :srid => config_[:srid])
|
184
184
|
end
|
185
185
|
obj_ = parser_.parse_hex('00a0000002000003e8000000023ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000')
|
186
186
|
assert_equal(::RGeo::Feature::LineString, obj_.geometry_type)
|
@@ -192,7 +192,7 @@ module RGeo
|
|
192
192
|
|
193
193
|
|
194
194
|
def test_linestring_with_wkb12_z
|
195
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
195
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
|
196
196
|
parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_wkb12 => true)
|
197
197
|
obj_ = parser_.parse_hex('00000003ea000000023ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000')
|
198
198
|
assert_equal(::RGeo::Feature::LineString, obj_.geometry_type)
|
@@ -249,7 +249,7 @@ module RGeo
|
|
249
249
|
|
250
250
|
|
251
251
|
def test_multipoint_with_ewkb_z
|
252
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
252
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
|
253
253
|
parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_ewkb => true)
|
254
254
|
obj_ = parser_.parse_hex('00800000040000000200800000013ff0000000000000400000000000000040140000000000000080000001400800000000000040100000000000004018000000000000')
|
255
255
|
assert_equal(::RGeo::Feature::MultiPoint, obj_.geometry_type)
|
@@ -263,7 +263,7 @@ module RGeo
|
|
263
263
|
|
264
264
|
|
265
265
|
def test_multipoint_ewkb_with_mixed_z
|
266
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
266
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
|
267
267
|
parser_ = ::RGeo::WKRep::WKBParser.new(factory_, :support_ewkb => true)
|
268
268
|
assert_raise(::RGeo::Error::ParseError) do
|
269
269
|
obj_ = parser_.parse_hex('00800000040000000200800000013ff000000000000040000000000000004014000000000000000000000140080000000000004010000000000000')
|
@@ -47,9 +47,9 @@ module RGeo
|
|
47
47
|
|
48
48
|
def setup
|
49
49
|
@factory = ::RGeo::Cartesian.preferred_factory(:srid => 1000)
|
50
|
-
@factoryz = ::RGeo::Cartesian.preferred_factory(:srid => 1000, :
|
51
|
-
@factorym = ::RGeo::Cartesian.preferred_factory(:srid => 1000, :
|
52
|
-
@factoryzm = ::RGeo::Cartesian.preferred_factory(:srid => 1000, :
|
50
|
+
@factoryz = ::RGeo::Cartesian.preferred_factory(:srid => 1000, :has_z_coordinate => true)
|
51
|
+
@factorym = ::RGeo::Cartesian.preferred_factory(:srid => 1000, :has_m_coordinate => true)
|
52
|
+
@factoryzm = ::RGeo::Cartesian.preferred_factory(:srid => 1000, :has_z_coordinate => true, :has_m_coordinate => true)
|
53
53
|
end
|
54
54
|
|
55
55
|
|
data/test/wkrep/tc_wkt_parser.rb
CHANGED
@@ -73,7 +73,7 @@ module RGeo
|
|
73
73
|
|
74
74
|
|
75
75
|
def test_values_negative
|
76
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
76
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
|
77
77
|
parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
|
78
78
|
obj_ = parser_.parse('POINT(-1. -.5 -5.5)')
|
79
79
|
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
@@ -101,7 +101,7 @@ module RGeo
|
|
101
101
|
|
102
102
|
|
103
103
|
def test_point_with_z
|
104
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
104
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
|
105
105
|
parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
|
106
106
|
obj_ = parser_.parse('POINT(1 2 3)')
|
107
107
|
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
@@ -111,7 +111,7 @@ module RGeo
|
|
111
111
|
|
112
112
|
|
113
113
|
def test_point_with_m
|
114
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
114
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_m_coordinate => true)
|
115
115
|
parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
|
116
116
|
obj_ = parser_.parse('POINT(1 2 3)')
|
117
117
|
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
@@ -130,7 +130,7 @@ module RGeo
|
|
130
130
|
|
131
131
|
|
132
132
|
def test_point_wkt12_z
|
133
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
133
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
|
134
134
|
parser_ = ::RGeo::WKRep::WKTParser.new(factory_, :support_wkt12 => true)
|
135
135
|
obj_ = parser_.parse('POINT Z(1 2 3)')
|
136
136
|
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
@@ -149,7 +149,7 @@ module RGeo
|
|
149
149
|
|
150
150
|
|
151
151
|
def test_point_wkt12_m
|
152
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
152
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_m_coordinate => true)
|
153
153
|
parser_ = ::RGeo::WKRep::WKTParser.new(factory_, :support_wkt12 => true)
|
154
154
|
obj_ = parser_.parse('POINT M(1 2 3)')
|
155
155
|
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
@@ -159,7 +159,7 @@ module RGeo
|
|
159
159
|
|
160
160
|
|
161
161
|
def test_point_wkt12_m_with_factory_zm
|
162
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
162
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true, :has_m_coordinate => true)
|
163
163
|
parser_ = ::RGeo::WKRep::WKTParser.new(factory_, :support_wkt12 => true)
|
164
164
|
obj_ = parser_.parse('POINT M(1 2 3)')
|
165
165
|
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
@@ -169,7 +169,7 @@ module RGeo
|
|
169
169
|
|
170
170
|
|
171
171
|
def test_point_wkt12_m_too_many_coords
|
172
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
172
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_m_coordinate => true)
|
173
173
|
parser_ = ::RGeo::WKRep::WKTParser.new(factory_, :support_wkt12 => true)
|
174
174
|
assert_raise(::RGeo::Error::ParseError) do
|
175
175
|
obj_ = parser_.parse('POINT M(1 2 3 4)')
|
@@ -178,7 +178,7 @@ module RGeo
|
|
178
178
|
|
179
179
|
|
180
180
|
def test_point_wkt12_zm
|
181
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
181
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true, :has_m_coordinate => true)
|
182
182
|
parser_ = ::RGeo::WKRep::WKTParser.new(factory_, :support_wkt12 => true)
|
183
183
|
obj_ = parser_.parse('POINT ZM(1 2 3 4)')
|
184
184
|
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
@@ -188,7 +188,7 @@ module RGeo
|
|
188
188
|
|
189
189
|
|
190
190
|
def test_point_wkt12_zm_not_enough_coords
|
191
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
191
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true, :has_m_coordinate => true)
|
192
192
|
parser_ = ::RGeo::WKRep::WKTParser.new(factory_, :support_wkt12 => true)
|
193
193
|
assert_raise(::RGeo::Error::ParseError) do
|
194
194
|
obj_ = parser_.parse('POINT ZM(1 2 3)')
|
@@ -197,7 +197,7 @@ module RGeo
|
|
197
197
|
|
198
198
|
|
199
199
|
def test_point_ewkt_z
|
200
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
200
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
|
201
201
|
parser_ = ::RGeo::WKRep::WKTParser.new(factory_, :support_ewkt => true)
|
202
202
|
obj_ = parser_.parse('POINT(1 2 3)')
|
203
203
|
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
@@ -207,7 +207,7 @@ module RGeo
|
|
207
207
|
|
208
208
|
|
209
209
|
def test_point_ewkt_m
|
210
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
210
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_m_coordinate => true)
|
211
211
|
parser_ = ::RGeo::WKRep::WKTParser.new(factory_, :support_ewkt => true)
|
212
212
|
obj_ = parser_.parse('POINTM(1 2 3)')
|
213
213
|
assert_equal(::RGeo::Feature::Point, obj_.geometry_type)
|
@@ -227,7 +227,7 @@ module RGeo
|
|
227
227
|
|
228
228
|
|
229
229
|
def test_point_ewkt_m_too_many_coords
|
230
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
230
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_m_coordinate => true)
|
231
231
|
parser_ = ::RGeo::WKRep::WKTParser.new(factory_, :support_ewkt => true)
|
232
232
|
assert_raise(::RGeo::Error::ParseError) do
|
233
233
|
obj_ = parser_.parse('POINTM(1 2 3 4)')
|
@@ -236,7 +236,7 @@ module RGeo
|
|
236
236
|
|
237
237
|
|
238
238
|
def test_point_strict_wkt11_with_z
|
239
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
239
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
|
240
240
|
parser_ = ::RGeo::WKRep::WKTParser.new(factory_, :strict_wkt11 => true)
|
241
241
|
assert_raise(::RGeo::Error::ParseError) do
|
242
242
|
obj_ = parser_.parse('POINT(1 2 3)')
|
@@ -266,7 +266,7 @@ module RGeo
|
|
266
266
|
|
267
267
|
|
268
268
|
def test_linestring_with_z
|
269
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
269
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
|
270
270
|
parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
|
271
271
|
obj_ = parser_.parse('LINESTRING(1 2 3, 4 5 6,7 8 9)')
|
272
272
|
assert_equal(::RGeo::Feature::LineString, obj_.geometry_type)
|
@@ -277,7 +277,7 @@ module RGeo
|
|
277
277
|
|
278
278
|
|
279
279
|
def test_linestring_with_inconsistent_coords
|
280
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
280
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
|
281
281
|
parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
|
282
282
|
assert_raise(::RGeo::Error::ParseError) do
|
283
283
|
obj_ = parser_.parse('LINESTRING(1 2 3, 4 5,7 8 9)')
|
@@ -286,7 +286,7 @@ module RGeo
|
|
286
286
|
|
287
287
|
|
288
288
|
def test_linestring_wkt12_m
|
289
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
289
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true, :has_m_coordinate => true)
|
290
290
|
parser_ = ::RGeo::WKRep::WKTParser.new(factory_, :support_wkt12 => true)
|
291
291
|
obj_ = parser_.parse('LINESTRING M(1 2 3,5 6 7)')
|
292
292
|
assert_equal(::RGeo::Feature::LineString, obj_.geometry_type)
|
@@ -329,7 +329,7 @@ module RGeo
|
|
329
329
|
|
330
330
|
|
331
331
|
def test_polygon_with_holes_and_z
|
332
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
332
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
|
333
333
|
parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
|
334
334
|
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))')
|
335
335
|
assert_equal(::RGeo::Feature::Polygon, obj_.geometry_type)
|
@@ -392,7 +392,7 @@ module RGeo
|
|
392
392
|
|
393
393
|
|
394
394
|
def test_multipolygon_basic
|
395
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
395
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
|
396
396
|
parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
|
397
397
|
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)))')
|
398
398
|
assert_equal(::RGeo::Feature::MultiPolygon, obj_.geometry_type)
|
@@ -433,7 +433,7 @@ module RGeo
|
|
433
433
|
|
434
434
|
|
435
435
|
def test_collection_z
|
436
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
436
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
|
437
437
|
parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
|
438
438
|
obj_ = parser_.parse('GEOMETRYCOLLECTION(POINT(-1 -2 0),LINESTRING(1 2 0, 3 4 0, 5 6 0))')
|
439
439
|
assert_equal(::RGeo::Feature::GeometryCollection, obj_.geometry_type)
|
@@ -447,7 +447,7 @@ module RGeo
|
|
447
447
|
|
448
448
|
|
449
449
|
def test_collection_dimension_mismatch
|
450
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
450
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true)
|
451
451
|
parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
|
452
452
|
assert_raise(::RGeo::Error::ParseError) do
|
453
453
|
obj_ = parser_.parse('GEOMETRYCOLLECTION(POINT(-1 -2),LINESTRING(1 2 0, 3 4 0, 5 6 0))')
|
@@ -456,7 +456,7 @@ module RGeo
|
|
456
456
|
|
457
457
|
|
458
458
|
def test_collection_wkt12_type_mismatch
|
459
|
-
factory_ = ::RGeo::Cartesian.preferred_factory(:
|
459
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:has_z_coordinate => true, :has_m_coordinate => true)
|
460
460
|
parser_ = ::RGeo::WKRep::WKTParser.new(factory_, :support_wkt12 => true)
|
461
461
|
assert_raise(::RGeo::Error::ParseError) do
|
462
462
|
obj_ = parser_.parse('GEOMETRYCOLLECTION Z(POINT Z(-1 -2 0),LINESTRING M(1 2 0, 3 4 0, 5 6 0))')
|