geos-extensions 0.2.2 → 0.3.0
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.
- checksums.yaml +15 -0
- data/.gitignore +3 -0
- data/Gemfile +17 -0
- data/Guardfile +17 -0
- data/MIT-LICENSE +1 -1
- data/README.rdoc +19 -91
- data/Rakefile +1 -12
- data/geos-extensions.gemspec +1 -9
- data/lib/geos-extensions.rb +1 -9
- data/lib/geos/coordinate_sequence.rb +92 -0
- data/lib/geos/extensions/version.rb +1 -1
- data/lib/geos/geometry.rb +252 -0
- data/lib/geos/geometry_collection.rb +60 -0
- data/lib/geos/geos_helper.rb +86 -72
- data/lib/geos/google_maps.rb +1 -0
- data/lib/geos/google_maps/api_2.rb +9 -23
- data/lib/geos/google_maps/api_3.rb +10 -24
- data/lib/geos/google_maps/api_common.rb +41 -0
- data/lib/geos/line_string.rb +15 -0
- data/lib/geos/multi_line_string.rb +15 -0
- data/lib/geos/multi_point.rb +15 -0
- data/lib/geos/multi_polygon.rb +27 -0
- data/lib/geos/point.rb +120 -0
- data/lib/geos/polygon.rb +158 -0
- data/lib/geos/yaml.rb +30 -0
- data/lib/geos/yaml/psych.rb +18 -0
- data/lib/geos/yaml/syck.rb +41 -0
- data/lib/geos_extensions.rb +110 -711
- data/test/google_maps_api_2_tests.rb +54 -32
- data/test/google_maps_api_3_tests.rb +58 -36
- data/test/google_maps_polyline_encoder_tests.rb +1 -1
- data/test/helper_tests.rb +28 -0
- data/test/misc_tests.rb +130 -10
- data/test/reader_tests.rb +38 -1
- data/test/test_helper.rb +54 -146
- data/test/writer_tests.rb +329 -10
- data/test/yaml_tests.rb +203 -0
- metadata +26 -102
- data/app/models/geos/geometry_column.rb +0 -39
- data/app/models/geos/spatial_ref_sys.rb +0 -12
- data/lib/geos/active_record_extensions.rb +0 -12
- data/lib/geos/active_record_extensions/connection_adapters/postgresql_adapter.rb +0 -151
- data/lib/geos/active_record_extensions/spatial_columns.rb +0 -367
- data/lib/geos/active_record_extensions/spatial_scopes.rb +0 -493
- data/lib/geos/rails/engine.rb +0 -6
- data/lib/tasks/test.rake +0 -42
- data/test/adapter_tests.rb +0 -38
- data/test/database.yml +0 -17
- data/test/fixtures/foo3ds.yml +0 -16
- data/test/fixtures/foo_geographies.yml +0 -16
- data/test/fixtures/foos.yml +0 -16
- data/test/geography_columns_tests.rb +0 -176
- data/test/geometry_columns_tests.rb +0 -178
- data/test/spatial_scopes_geographies_tests.rb +0 -107
- data/test/spatial_scopes_tests.rb +0 -337
@@ -1,107 +0,0 @@
|
|
1
|
-
|
2
|
-
$: << File.dirname(__FILE__)
|
3
|
-
require 'test_helper'
|
4
|
-
|
5
|
-
if ENV['TEST_ACTIVERECORD']
|
6
|
-
class SpatialScopesGeographiesTests < ActiveRecord::TestCase
|
7
|
-
include TestHelper
|
8
|
-
include ActiveRecord::TestFixtures
|
9
|
-
|
10
|
-
self.fixture_path = File.join(File.dirname(__FILE__), 'fixtures')
|
11
|
-
fixtures :foo_geographies
|
12
|
-
|
13
|
-
def ids_tester(method, args, ids = [], options = {})
|
14
|
-
geoms = FooGeography.send(method, *Array(args)).all(options)
|
15
|
-
assert_equal(ids.sort, geoms.collect(&:id).sort)
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_covers
|
19
|
-
ids_tester(:st_covers, 'POINT(0 0)', [ 3 ], :conditions => {
|
20
|
-
:id => [ 3 ]
|
21
|
-
})
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_coveredby
|
25
|
-
ids_tester(:st_coveredby, 'POLYGON((-6 -6, -6 6, 6 6, 6 -6, -6 -6))', [ 1 ], :conditions => {
|
26
|
-
:id => [ 1, 2 ]
|
27
|
-
})
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_intersects
|
31
|
-
ids_tester(:st_intersects, 'LINESTRING(-5 -5, 10 10)', [ 2, 3 ])
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_dwithin
|
35
|
-
ids_tester(:st_dwithin, [ 'POINT(5 5)', 10 ], [ 3 ])
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_allow_null
|
39
|
-
begin
|
40
|
-
foo = FooGeography.create(:name => 'four')
|
41
|
-
ids_tester(:st_covers, [ 'POINT(3 3)', { :allow_null => true } ], [ 3, foo.id ])
|
42
|
-
ensure
|
43
|
-
FooGeography.find_by_name('four').destroy
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_with_column
|
48
|
-
assert_equal([3], FooGeography.st_covers('POINT(7 7)', :column => :the_other_geom).all.collect(&:id).sort)
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_with_srid_switching
|
52
|
-
assert_equal([3], FooGeography.st_covers('SRID=4326; POINT(3 3)').all.collect(&:id).sort)
|
53
|
-
end
|
54
|
-
|
55
|
-
def test_with_srid_default
|
56
|
-
assert_equal([3], FooGeography.st_covers('SRID=default; POINT(3 3)').all.collect(&:id).sort)
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_with_srid_transform
|
60
|
-
assert_equal([3], FooGeography.st_covers('SRID=4269; POINT(7 7)', :column => :the_other_geom).all.collect(&:id).sort)
|
61
|
-
end
|
62
|
-
|
63
|
-
def test_order_by_distance
|
64
|
-
assert_equal([3, 1, 2], FooGeography.order_by_distance('POINT(1 1)').all.collect(&:id))
|
65
|
-
end
|
66
|
-
|
67
|
-
def test_order_by_distance_desc
|
68
|
-
assert_equal([2, 1, 3], FooGeography.order_by_distance('POINT(1 1)', :desc => true).all.collect(&:id))
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_order_by_area
|
72
|
-
assert_equal([1, 2, 3], FooGeography.order_by_area.order('id').all.collect(&:id))
|
73
|
-
end
|
74
|
-
|
75
|
-
def test_order_by_area_desc
|
76
|
-
assert_equal([3, 1, 2], FooGeography.order_by_area(:desc => true).order('id').all.collect(&:id))
|
77
|
-
end
|
78
|
-
|
79
|
-
def test_order_by_length
|
80
|
-
assert_equal([1, 2, 3], FooGeography.order_by_length.order('id').all.collect(&:id))
|
81
|
-
end
|
82
|
-
|
83
|
-
def test_order_by_length_desc
|
84
|
-
expected = if Geos::ActiveRecord.POSTGIS[:lib] >= '2.0'
|
85
|
-
[1, 2, 3]
|
86
|
-
else
|
87
|
-
[3, 1, 2]
|
88
|
-
end
|
89
|
-
|
90
|
-
assert_equal(expected, FooGeography.order_by_length(:desc => true).order('id').where('true = true').all.collect(&:id))
|
91
|
-
end
|
92
|
-
|
93
|
-
if Geos::ActiveRecord.POSTGIS[:lib] >= '2.0'
|
94
|
-
def test_order_by_perimeter
|
95
|
-
assert_equal([1, 2, 3], FooGeography.order_by_perimeter.order('id').all.collect(&:id))
|
96
|
-
end
|
97
|
-
|
98
|
-
def test_order_by_perimeter_desc
|
99
|
-
assert_equal([3, 1, 2], FooGeography.order_by_perimeter(:desc => true).order('id').all.collect(&:id))
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
def test_order_by_area_with_desc_symbol
|
104
|
-
assert_equal([3, 1, 2], FooGeography.order_by_area(:desc).order('id').all.collect(&:id))
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
@@ -1,337 +0,0 @@
|
|
1
|
-
|
2
|
-
$: << File.dirname(__FILE__)
|
3
|
-
require 'test_helper'
|
4
|
-
|
5
|
-
if ENV['TEST_ACTIVERECORD']
|
6
|
-
class SpatialScopesTests < ActiveRecord::TestCase
|
7
|
-
include TestHelper
|
8
|
-
include ActiveRecord::TestFixtures
|
9
|
-
|
10
|
-
self.fixture_path = File.join(File.dirname(__FILE__), 'fixtures')
|
11
|
-
fixtures :foos, :foo3ds
|
12
|
-
|
13
|
-
def ids_tester(method, args, ids = [], klass = Foo)
|
14
|
-
geoms = klass.send(method, *Array(args)).all
|
15
|
-
assert_equal(ids.sort, geoms.collect(&:id).sort)
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_contains
|
19
|
-
ids_tester(:st_contains, 'POINT(3 3)', [ 3 ])
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_containsproperly
|
23
|
-
ids_tester(:st_containsproperly, 'LINESTRING(-4 -4, 4 4)', [ 3 ])
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_covers
|
27
|
-
ids_tester(:st_covers, 'LINESTRING(-4 -4, 4 4)', [ 3 ])
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_coveredby
|
31
|
-
ids_tester(:st_coveredby, 'POLYGON((-6 -6, -6 6, 6 6, 6 -6, -6 -6))', [ 1, 3 ])
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_crosses
|
35
|
-
ids_tester(:st_crosses, 'LINESTRING(-6 -6, 4 4)', [ 3 ])
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_disjoint
|
39
|
-
ids_tester(:st_disjoint, 'POINT(100 100)', [ 1, 2, 3 ])
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_equal
|
43
|
-
ids_tester(:st_equals, 'POLYGON((-5 -5, -5 5, 5 5, 5 -5, -5 -5))', [ 3 ])
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_intersects
|
47
|
-
ids_tester(:st_intersects, 'LINESTRING(-5 -5, 10 10)', [ 1, 2, 3 ])
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_orderingequals
|
51
|
-
ids_tester(:st_orderingequals, 'POLYGON((-5 -5, -5 5, 5 5, 5 -5, -5 -5))', [ 3 ])
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_overlaps
|
55
|
-
ids_tester(:st_overlaps, 'POLYGON((-6 -6, -5 0, 0 0, 0 -5, -6 -6))', [ 3 ])
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_touches
|
59
|
-
ids_tester(:st_touches, 'POLYGON((-5 -5, -5 -10, -10 -10, -10 -5, -5 -5))', [ 3 ])
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_within
|
63
|
-
ids_tester(:st_within, 'POLYGON((-5 -5, 5 10, 20 20, 10 5, -5 -5))', [ 1, 2 ])
|
64
|
-
end
|
65
|
-
|
66
|
-
def test_dwithin
|
67
|
-
ids_tester(:st_dwithin, [ 'POINT(5 5)', 10 ], [ 1, 2, 3 ])
|
68
|
-
end
|
69
|
-
|
70
|
-
def test_dfullywithin
|
71
|
-
ids_tester(:st_dfullywithin, [ 'POINT(5 5)', 10 ], [ 1, 2 ])
|
72
|
-
end
|
73
|
-
|
74
|
-
def test_geometry_type
|
75
|
-
ids_tester(:st_geometry_type, 'ST_Point', [ 1, 2 ])
|
76
|
-
ids_tester(:st_geometry_type, [ 'ST_Point', 'ST_Polygon' ], [ 1, 2, 3 ])
|
77
|
-
ids_tester(:st_geometry_type, [ 'ST_MultiLineString' ], [])
|
78
|
-
end
|
79
|
-
|
80
|
-
def test_allow_null
|
81
|
-
begin
|
82
|
-
foo = Foo.create(:name => 'four')
|
83
|
-
ids_tester(:st_contains, [ 'POINT(3 3)', { :allow_null => true } ], [ 3, foo.id ])
|
84
|
-
ensure
|
85
|
-
Foo.find_by_name('four').destroy
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
def test_nil_relationship
|
90
|
-
assert_equal([ 1, 2, 3 ], Foo.st_within(nil).all.collect(&:id).sort)
|
91
|
-
end
|
92
|
-
|
93
|
-
def test_with_column
|
94
|
-
assert_equal([1, 2, 3], Foo.st_disjoint('POINT(100 100)', :column => :the_other_geom).all.collect(&:id).sort)
|
95
|
-
end
|
96
|
-
|
97
|
-
def test_with_srid_switching
|
98
|
-
assert_equal([1, 2, 3], Foo.st_disjoint('SRID=4326; POINT(100 100)').all.collect(&:id).sort)
|
99
|
-
end
|
100
|
-
|
101
|
-
def test_with_srid_default
|
102
|
-
assert_equal([1, 2, 3], Foo.st_disjoint('SRID=default; POINT(100 100)').all.collect(&:id).sort)
|
103
|
-
assert_equal([3], Foo.st_contains('SRID=default; POINT(-3 -3)').all.collect(&:id).sort)
|
104
|
-
end
|
105
|
-
|
106
|
-
def test_with_srid_transform
|
107
|
-
assert_equal([1, 2, 3], Foo.st_disjoint('SRID=4269; POINT(100 100)', :column => :the_other_geom).all.collect(&:id).sort)
|
108
|
-
assert_equal([3], Foo.st_contains('SRID=4269; POINT(7 7)', :column => :the_other_geom).all.collect(&:id).sort)
|
109
|
-
end
|
110
|
-
|
111
|
-
def test_order_by_distance
|
112
|
-
assert_equal([3, 1, 2], Foo.order_by_distance('POINT(1 1)').all.collect(&:id))
|
113
|
-
end
|
114
|
-
|
115
|
-
def test_order_by_distance_desc
|
116
|
-
assert_equal([2, 1, 3], Foo.order_by_distance('POINT(1 1)', :desc => true).all.collect(&:id))
|
117
|
-
end
|
118
|
-
|
119
|
-
def test_order_by_distance_sphere
|
120
|
-
assert_equal([3, 1, 2], Foo.order_by_distance_sphere('POINT(1 1)').all.collect(&:id))
|
121
|
-
end
|
122
|
-
|
123
|
-
def test_order_by_distance_sphere_desc
|
124
|
-
assert_equal([2, 1, 3], Foo.order_by_distance_sphere('POINT(1 1)', :desc => true).all.collect(&:id))
|
125
|
-
end
|
126
|
-
|
127
|
-
def test_order_by_max_distance
|
128
|
-
assert_equal([1, 3, 2], Foo.order_by_maxdistance('POINT(1 1)').all.collect(&:id))
|
129
|
-
end
|
130
|
-
|
131
|
-
def test_order_by_max_distance_desc
|
132
|
-
assert_equal([2, 3, 1], Foo.order_by_maxdistance('POINT(1 1)', :desc => true).all.collect(&:id))
|
133
|
-
end
|
134
|
-
|
135
|
-
def test_order_by_area
|
136
|
-
assert_equal([1, 2, 3], Foo.order_by_area.order('id').all.collect(&:id))
|
137
|
-
end
|
138
|
-
|
139
|
-
def test_order_by_area_desc
|
140
|
-
assert_equal([3, 1, 2], Foo.order_by_area(:desc => true).order('id').all.collect(&:id))
|
141
|
-
end
|
142
|
-
|
143
|
-
def test_order_by_ndims
|
144
|
-
assert_equal([1, 2, 3], Foo.order_by_ndims.order('id').all.collect(&:id))
|
145
|
-
end
|
146
|
-
|
147
|
-
def test_order_by_ndims_desc
|
148
|
-
assert_equal([1, 2, 3], Foo.order_by_ndims(:desc => true).order('id').all.collect(&:id))
|
149
|
-
end
|
150
|
-
|
151
|
-
def test_order_by_npoints
|
152
|
-
assert_equal([1, 2, 3], Foo.order_by_npoints.order('id').all.collect(&:id))
|
153
|
-
end
|
154
|
-
|
155
|
-
def test_order_by_npoints_desc
|
156
|
-
assert_equal([3, 1, 2], Foo.order_by_npoints(:desc => true).order('id').all.collect(&:id))
|
157
|
-
end
|
158
|
-
|
159
|
-
def test_order_by_nrings
|
160
|
-
assert_equal([1, 2, 3], Foo.order_by_nrings.order('id').all.collect(&:id))
|
161
|
-
end
|
162
|
-
|
163
|
-
def test_order_by_nrings_desc
|
164
|
-
assert_equal([3, 1, 2], Foo.order_by_nrings(:desc => true).order('id').all.collect(&:id))
|
165
|
-
end
|
166
|
-
|
167
|
-
def test_order_by_numgeometries
|
168
|
-
assert_equal([1, 2, 3], Foo.order_by_numgeometries.order('id').all.collect(&:id))
|
169
|
-
end
|
170
|
-
|
171
|
-
def test_order_by_numgeometries_desc
|
172
|
-
assert_equal([1, 2, 3], Foo.order_by_numgeometries(:desc => true).order('id').all.collect(&:id))
|
173
|
-
end
|
174
|
-
|
175
|
-
def test_order_by_numinteriorring
|
176
|
-
assert_equal([3, 1, 2], Foo.order_by_numinteriorring.order('id').all.collect(&:id))
|
177
|
-
end
|
178
|
-
|
179
|
-
def test_order_by_numinteriorring_desc
|
180
|
-
assert_equal([1, 2, 3], Foo.order_by_numinteriorring(:desc => true).order('id').all.collect(&:id))
|
181
|
-
end
|
182
|
-
|
183
|
-
def test_order_by_numinteriorrings
|
184
|
-
assert_equal([3, 1, 2], Foo.order_by_numinteriorrings.order('id').all.collect(&:id))
|
185
|
-
end
|
186
|
-
|
187
|
-
def test_order_by_numinteriorrings_desc
|
188
|
-
assert_equal([1, 2, 3], Foo.order_by_numinteriorrings(:desc => true).order('id').all.collect(&:id))
|
189
|
-
end
|
190
|
-
|
191
|
-
def test_order_by_numpoints
|
192
|
-
assert_equal([1, 2, 3], Foo.order_by_numpoints.order('id').all.collect(&:id))
|
193
|
-
end
|
194
|
-
|
195
|
-
def test_order_by_numpoints_desc
|
196
|
-
assert_equal([1, 2, 3], Foo.order_by_numpoints(:desc => true).order('id').all.collect(&:id))
|
197
|
-
end
|
198
|
-
|
199
|
-
def test_order_by_length3d
|
200
|
-
assert_equal([1, 2, 3], Foo.order_by_length3d.order('id').all.collect(&:id))
|
201
|
-
end
|
202
|
-
|
203
|
-
def test_order_by_length3d_desc
|
204
|
-
assert_equal([1, 2, 3], Foo.order_by_length3d(:desc => true).order('id').all.collect(&:id))
|
205
|
-
end
|
206
|
-
|
207
|
-
def test_order_by_length
|
208
|
-
assert_equal([1, 2, 3], Foo.order_by_length.order('id').all.collect(&:id))
|
209
|
-
end
|
210
|
-
|
211
|
-
def test_order_by_length_desc
|
212
|
-
assert_equal([1, 2, 3], Foo.order_by_length(:desc => true).order('id').all.collect(&:id))
|
213
|
-
end
|
214
|
-
|
215
|
-
def test_order_by_length2d
|
216
|
-
assert_equal([1, 2, 3], Foo.order_by_length2d.order('id').all.collect(&:id))
|
217
|
-
end
|
218
|
-
|
219
|
-
def test_order_by_length2d_desc
|
220
|
-
assert_equal([1, 2, 3], Foo.order_by_length2d(:desc => true).order('id').all.collect(&:id))
|
221
|
-
end
|
222
|
-
|
223
|
-
def test_order_by_length3d_spheroid
|
224
|
-
assert_equal([1, 2, 3], Foo.order_by_length3d_spheroid('SPHEROID["WGS 84", 6378137, 298.257223563]').order('id').all.collect(&:id))
|
225
|
-
end
|
226
|
-
|
227
|
-
def test_order_by_length3d_spheroid_desc
|
228
|
-
expected = if Geos::ActiveRecord.POSTGIS[:lib] >= '2.0'
|
229
|
-
[3, 1, 2]
|
230
|
-
else
|
231
|
-
[1, 2, 3]
|
232
|
-
end
|
233
|
-
|
234
|
-
assert_equal(expected, Foo.order_by_length3d_spheroid('SPHEROID["WGS 84", 6378137, 298.257223563]', :desc => true).order('id').all.collect(&:id))
|
235
|
-
end
|
236
|
-
|
237
|
-
def test_order_by_length2d_spheroid
|
238
|
-
assert_equal([1, 2, 3], Foo.order_by_length2d_spheroid('SPHEROID["WGS 84", 6378137, 298.257223563]').order('id').all.collect(&:id))
|
239
|
-
end
|
240
|
-
|
241
|
-
def test_order_by_length2d_spheroid_desc
|
242
|
-
assert_equal([3, 1, 2], Foo.order_by_length2d_spheroid('SPHEROID["WGS 84", 6378137, 298.257223563]', :desc => true).order('id').all.collect(&:id))
|
243
|
-
end
|
244
|
-
|
245
|
-
def test_order_by_length_spheroid
|
246
|
-
assert_equal([1, 2, 3], Foo.order_by_length_spheroid('SPHEROID["WGS 84", 6378137, 298.257223563]').order('id').all.collect(&:id))
|
247
|
-
end
|
248
|
-
|
249
|
-
def test_order_by_length_spheroid_desc
|
250
|
-
expected = if Geos::ActiveRecord.POSTGIS[:lib] >= '2.0'
|
251
|
-
[3, 1, 2]
|
252
|
-
else
|
253
|
-
[1, 2, 3]
|
254
|
-
end
|
255
|
-
|
256
|
-
assert_equal(expected, Foo.order_by_length_spheroid('SPHEROID["WGS 84", 6378137, 298.257223563]', :desc => true).order('id').all.collect(&:id))
|
257
|
-
end
|
258
|
-
|
259
|
-
def test_order_by_perimeter
|
260
|
-
assert_equal([1, 2, 3], Foo.order_by_perimeter.order('id').all.collect(&:id))
|
261
|
-
end
|
262
|
-
|
263
|
-
def test_order_by_perimeter_desc
|
264
|
-
assert_equal([3, 1, 2], Foo.order_by_perimeter(:desc => true).order('id').all.collect(&:id))
|
265
|
-
end
|
266
|
-
|
267
|
-
def test_order_by_perimeter2d
|
268
|
-
assert_equal([1, 2, 3], Foo.order_by_perimeter2d.order('id').all.collect(&:id))
|
269
|
-
end
|
270
|
-
|
271
|
-
def test_order_by_perimeter2d_desc
|
272
|
-
assert_equal([3, 1, 2], Foo.order_by_perimeter2d(:desc => true).order('id').all.collect(&:id))
|
273
|
-
end
|
274
|
-
|
275
|
-
def test_order_by_perimeter3d
|
276
|
-
assert_equal([1, 2, 3], Foo.order_by_perimeter3d.order('id').all.collect(&:id))
|
277
|
-
end
|
278
|
-
|
279
|
-
def test_order_by_perimeter3d_desc
|
280
|
-
assert_equal([3, 1, 2], Foo.order_by_perimeter3d(:desc => true).order('id').all.collect(&:id))
|
281
|
-
end
|
282
|
-
|
283
|
-
def test_order_by_hausdorffdistance
|
284
|
-
assert_equal([1, 3, 2], Foo.order_by_hausdorffdistance('POINT(1 1)').all.collect(&:id))
|
285
|
-
end
|
286
|
-
|
287
|
-
def test_order_by_hausdorffdistance_desc
|
288
|
-
assert_equal([2, 3, 1], Foo.order_by_hausdorffdistance('POINT(1 1)', :desc => true).all.collect(&:id))
|
289
|
-
end
|
290
|
-
|
291
|
-
def test_order_by_hausdorffdistance_with_densify_frac
|
292
|
-
assert_equal([1, 3, 2], Foo.order_by_hausdorffdistance('POINT(1 1)', 0.314).all.collect(&:id))
|
293
|
-
end
|
294
|
-
|
295
|
-
def test_order_by_distance_spheroid
|
296
|
-
assert_equal([2, 3, 1], Foo.order_by_distance_spheroid('POINT(10 10)', 'SPHEROID["WGS 84", 6378137, 298.257223563]').order('id').all.collect(&:id))
|
297
|
-
end
|
298
|
-
|
299
|
-
def test_order_by_distance_spheroid_desc
|
300
|
-
assert_equal([1, 3, 2], Foo.order_by_distance_spheroid('POINT(10 10)', 'SPHEROID["WGS 84", 6378137, 298.257223563]', :desc => true).order('id').all.collect(&:id))
|
301
|
-
end
|
302
|
-
|
303
|
-
def test_order_by_area_with_desc_symbol
|
304
|
-
assert_equal([3, 1, 2], Foo.order_by_area(:desc).order('id').all.collect(&:id))
|
305
|
-
end
|
306
|
-
|
307
|
-
if Foo3d.respond_to?(:st_3dintersects)
|
308
|
-
def test_3dintersects
|
309
|
-
ids_tester(:st_3dintersects, 'LINESTRING(-5 -5 -5, 10 10 10)', [ 1, 3 ], Foo3d)
|
310
|
-
end
|
311
|
-
end
|
312
|
-
|
313
|
-
if Foo3d.respond_to?(:order_by_3ddistance)
|
314
|
-
def test_3ddistance
|
315
|
-
assert_equal([3, 2, 1], Foo3d.order_by_3ddistance('POINT(10 10)').order('id').all.collect(&:id))
|
316
|
-
end
|
317
|
-
end
|
318
|
-
|
319
|
-
if Foo3d.respond_to?(:order_by_3dmaxdistance)
|
320
|
-
def test_3dmaxdistance
|
321
|
-
assert_equal([2, 1, 3], Foo3d.order_by_3dmaxdistance('POINT(10 10)').order('id').all.collect(&:id))
|
322
|
-
end
|
323
|
-
end
|
324
|
-
|
325
|
-
if Foo3d.respond_to?(:st_3ddwithin)
|
326
|
-
def test_3ddwithin
|
327
|
-
ids_tester(:st_3ddwithin, [ 'LINESTRING(-5 -5 -5, 10 10 10)', 10 ], [ 1, 2, 3 ], Foo3d)
|
328
|
-
end
|
329
|
-
end
|
330
|
-
|
331
|
-
if Foo3d.respond_to?(:st_3ddfullywithin)
|
332
|
-
def test_3ddfullywithin
|
333
|
-
ids_tester(:st_3ddfullywithin, [ 'LINESTRING(-10 -10 -10, 10 10 10)', 100 ], [ 1, 2, 3 ], Foo3d)
|
334
|
-
end
|
335
|
-
end
|
336
|
-
end
|
337
|
-
end
|