ffi-geos 0.0.1.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +22 -0
- data/README.rdoc +135 -0
- data/Rakefile +41 -0
- data/VERSION +1 -0
- data/lib/coordinate_sequence.rb +126 -0
- data/lib/ffi-geos.rb +810 -0
- data/lib/geometry.rb +504 -0
- data/lib/geometry_collection.rb +28 -0
- data/lib/line_string.rb +61 -0
- data/lib/linear_ring.rb +5 -0
- data/lib/multi_line_string.rb +5 -0
- data/lib/multi_point.rb +5 -0
- data/lib/multi_polygon.rb +5 -0
- data/lib/point.rb +22 -0
- data/lib/polygon.rb +20 -0
- data/lib/prepared_geometry.rb +42 -0
- data/lib/strtree.rb +111 -0
- data/lib/tools.rb +54 -0
- data/lib/utils.rb +145 -0
- data/lib/wkb_reader.rb +33 -0
- data/lib/wkb_writer.rb +95 -0
- data/lib/wkt_reader.rb +29 -0
- data/lib/wkt_writer.rb +108 -0
- data/test/coordinate_sequence_tests.rb +70 -0
- data/test/geometry_tests.rb +1499 -0
- data/test/misc_tests.rb +53 -0
- data/test/point_tests.rb +31 -0
- data/test/prepared_geometry_tests.rb +28 -0
- data/test/strtree_tests.rb +54 -0
- data/test/test_helper.rb +40 -0
- data/test/utils_tests.rb +333 -0
- data/test/wkb_reader_tests.rb +188 -0
- data/test/wkb_writer_tests.rb +435 -0
- data/test/wkt_reader_tests.rb +120 -0
- data/test/wkt_writer_tests.rb +149 -0
- metadata +114 -0
@@ -0,0 +1,188 @@
|
|
1
|
+
|
2
|
+
$: << File.dirname(__FILE__)
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
class WkbReaderTests < Test::Unit::TestCase
|
6
|
+
include TestHelper
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@wkb_reader = Geos::WkbReader.new
|
10
|
+
@writer = Geos::WktWriter.new
|
11
|
+
@reader = Geos::WktReader.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def wkb_tester(expected, g, type_id, geom_type, klass, srid, hex = true)
|
15
|
+
geom = if hex
|
16
|
+
@wkb_reader.read_hex(g)
|
17
|
+
else
|
18
|
+
@wkb_reader.read(g)
|
19
|
+
end
|
20
|
+
assert(geom)
|
21
|
+
assert_equal(type_id, geom.type_id)
|
22
|
+
assert_equal(geom_type, geom.geom_type)
|
23
|
+
assert(geom.is_a?(klass))
|
24
|
+
assert(read(expected).eql_exact?(geom, TOLERANCE))
|
25
|
+
assert_equal(srid, geom.srid)
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_2d_little_endian
|
29
|
+
wkb_tester(
|
30
|
+
'POINT(6 7)',
|
31
|
+
'010100000000000000000018400000000000001C40',
|
32
|
+
Geos::GEOS_POINT,
|
33
|
+
'Point',
|
34
|
+
Geos::Point,
|
35
|
+
0
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_2d_big_endian
|
40
|
+
wkb_tester(
|
41
|
+
'POINT (6 7)',
|
42
|
+
'00000000014018000000000000401C000000000000',
|
43
|
+
Geos::GEOS_POINT,
|
44
|
+
'Point',
|
45
|
+
Geos::Point,
|
46
|
+
0
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_2d_little_endian_srid
|
51
|
+
wkb_tester(
|
52
|
+
'POINT (6 7)',
|
53
|
+
'01010000202B00000000000000000018400000000000001C40',
|
54
|
+
Geos::GEOS_POINT,
|
55
|
+
'Point',
|
56
|
+
Geos::Point,
|
57
|
+
43
|
58
|
+
)
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_2d_big_endian_srid
|
62
|
+
wkb_tester(
|
63
|
+
'POINT (6 7)',
|
64
|
+
'00200000010000002B4018000000000000401C000000000000',
|
65
|
+
Geos::GEOS_POINT,
|
66
|
+
'Point',
|
67
|
+
Geos::Point,
|
68
|
+
43
|
69
|
+
)
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_3d_little_endian
|
73
|
+
wkb_tester(
|
74
|
+
'POINT Z (6 7 8)',
|
75
|
+
'010100008000000000000018400000000000001C400000000000002040',
|
76
|
+
Geos::GEOS_POINT,
|
77
|
+
'Point',
|
78
|
+
Geos::Point,
|
79
|
+
0
|
80
|
+
)
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_3d_big_endian
|
84
|
+
wkb_tester(
|
85
|
+
'POINT Z (6 7 8)',
|
86
|
+
'00800000014018000000000000401C0000000000004020000000000000',
|
87
|
+
Geos::GEOS_POINT,
|
88
|
+
'Point',
|
89
|
+
Geos::Point,
|
90
|
+
0
|
91
|
+
)
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_3d_big_endian_srid
|
95
|
+
wkb_tester(
|
96
|
+
'POINT Z (6 7 8)',
|
97
|
+
'00A0000001000000354018000000000000401C0000000000004020000000000000',
|
98
|
+
Geos::GEOS_POINT,
|
99
|
+
'Point',
|
100
|
+
Geos::Point,
|
101
|
+
53
|
102
|
+
)
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_2d_little_endian_binary
|
106
|
+
wkb_tester(
|
107
|
+
'POINT(6 7)',
|
108
|
+
"\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x18\x40\x00\x00\x00\x00\x00\x00\x1C\x40",
|
109
|
+
Geos::GEOS_POINT,
|
110
|
+
'Point',
|
111
|
+
Geos::Point,
|
112
|
+
0,
|
113
|
+
false
|
114
|
+
)
|
115
|
+
end
|
116
|
+
|
117
|
+
def test_2d_big_endian_binary
|
118
|
+
wkb_tester(
|
119
|
+
'POINT (6 7)',
|
120
|
+
"\x00\x00\x00\x00\x01\x40\x18\x00\x00\x00\x00\x00\x00\x40\x1C\x00\x00\x00\x00\x00\x00",
|
121
|
+
Geos::GEOS_POINT,
|
122
|
+
'Point',
|
123
|
+
Geos::Point,
|
124
|
+
0,
|
125
|
+
false
|
126
|
+
)
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_2d_little_endian_srid_binary
|
130
|
+
wkb_tester(
|
131
|
+
'POINT (6 7)',
|
132
|
+
"\x01\x01\x00\x00\x20\x2B\x00\x00\x00\x00\x00\x00\x00\x00\x00\x18\x40\x00\x00\x00\x00\x00\x00\x1C\x40",
|
133
|
+
Geos::GEOS_POINT,
|
134
|
+
'Point',
|
135
|
+
Geos::Point,
|
136
|
+
43,
|
137
|
+
false
|
138
|
+
)
|
139
|
+
end
|
140
|
+
|
141
|
+
def test_2d_big_endian_srid_binary
|
142
|
+
wkb_tester(
|
143
|
+
'POINT (6 7)',
|
144
|
+
"\x00\x20\x00\x00\x01\x00\x00\x00\x2B\x40\x18\x00\x00\x00\x00\x00\x00\x40\x1C\x00\x00\x00\x00\x00\x00",
|
145
|
+
Geos::GEOS_POINT,
|
146
|
+
'Point',
|
147
|
+
Geos::Point,
|
148
|
+
43,
|
149
|
+
false
|
150
|
+
)
|
151
|
+
end
|
152
|
+
|
153
|
+
def test_3d_little_endian_binary
|
154
|
+
wkb_tester(
|
155
|
+
'POINT Z (6 7 8)',
|
156
|
+
"\x01\x01\x00\x00\x80\x00\x00\x00\x00\x00\x00\x18\x40\x00\x00\x00\x00\x00\x00\x1C\x40\x00\x00\x00\x00\x00\x00\x20\x40",
|
157
|
+
Geos::GEOS_POINT,
|
158
|
+
'Point',
|
159
|
+
Geos::Point,
|
160
|
+
0,
|
161
|
+
false
|
162
|
+
)
|
163
|
+
end
|
164
|
+
|
165
|
+
def test_3d_big_endian_binary
|
166
|
+
wkb_tester(
|
167
|
+
'POINT Z (6 7 8)',
|
168
|
+
"\x00\x80\x00\x00\x01\x40\x18\x00\x00\x00\x00\x00\x00\x40\x1C\x00\x00\x00\x00\x00\x00\x40\x20\x00\x00\x00\x00\x00\x00",
|
169
|
+
Geos::GEOS_POINT,
|
170
|
+
'Point',
|
171
|
+
Geos::Point,
|
172
|
+
0,
|
173
|
+
false
|
174
|
+
)
|
175
|
+
end
|
176
|
+
|
177
|
+
def test_3d_big_endian_srid_binary
|
178
|
+
wkb_tester(
|
179
|
+
'POINT Z (6 7 8)',
|
180
|
+
"\x00\xA0\x00\x00\x01\x00\x00\x00\x35\x40\x18\x00\x00\x00\x00\x00\x00\x40\x1C\x00\x00\x00\x00\x00\x00\x40\x20\x00\x00\x00\x00\x00\x00",
|
181
|
+
Geos::GEOS_POINT,
|
182
|
+
'Point',
|
183
|
+
Geos::Point,
|
184
|
+
53,
|
185
|
+
false
|
186
|
+
)
|
187
|
+
end
|
188
|
+
end
|
@@ -0,0 +1,435 @@
|
|
1
|
+
|
2
|
+
$: << File.dirname(__FILE__)
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
class WkbWriterTests < Test::Unit::TestCase
|
6
|
+
include TestHelper
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@wkb_writer = Geos::WkbWriter.new
|
10
|
+
@writer = Geos::WktWriter.new
|
11
|
+
@reader = Geos::WktReader.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def wkb_tester(expected, g, dimensions, byte_order, srid, include_srid, hex = true)
|
15
|
+
geom = read(g)
|
16
|
+
geom.srid = srid
|
17
|
+
|
18
|
+
@wkb_writer.output_dimensions = dimensions
|
19
|
+
@wkb_writer.byte_order = byte_order
|
20
|
+
@wkb_writer.include_srid = include_srid
|
21
|
+
|
22
|
+
result = if hex
|
23
|
+
@wkb_writer.write_hex(geom)
|
24
|
+
else
|
25
|
+
@wkb_writer.write(geom)
|
26
|
+
end
|
27
|
+
|
28
|
+
assert_equal(expected, result)
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_2d_little_endian
|
32
|
+
wkb_tester(
|
33
|
+
'010100000000000000000018400000000000001C40',
|
34
|
+
'POINT(6 7)',
|
35
|
+
2,
|
36
|
+
:ndr,
|
37
|
+
43,
|
38
|
+
false
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_2d_little_endian_with_srid
|
43
|
+
wkb_tester(
|
44
|
+
'01010000202B00000000000000000018400000000000001C40',
|
45
|
+
'POINT(6 7)',
|
46
|
+
2,
|
47
|
+
:ndr,
|
48
|
+
43,
|
49
|
+
true
|
50
|
+
)
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_2d_big_endian
|
54
|
+
wkb_tester(
|
55
|
+
'00000000014018000000000000401C000000000000',
|
56
|
+
'POINT(6 7)',
|
57
|
+
2,
|
58
|
+
:xdr,
|
59
|
+
43,
|
60
|
+
false
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_2d_big_endian_with_srid
|
65
|
+
wkb_tester(
|
66
|
+
'00200000010000002B4018000000000000401C000000000000',
|
67
|
+
'POINT(6 7)',
|
68
|
+
2,
|
69
|
+
:xdr,
|
70
|
+
43,
|
71
|
+
true
|
72
|
+
)
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_3d_little_endian_with_2d_output
|
76
|
+
wkb_tester(
|
77
|
+
'010100000000000000000018400000000000001C40',
|
78
|
+
'POINT(6 7)',
|
79
|
+
3,
|
80
|
+
:ndr,
|
81
|
+
43,
|
82
|
+
false
|
83
|
+
)
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_3d_little_endian__with_2d_output_with_srid
|
87
|
+
wkb_tester(
|
88
|
+
'01010000202B00000000000000000018400000000000001C40',
|
89
|
+
'POINT(6 7)',
|
90
|
+
3,
|
91
|
+
:ndr,
|
92
|
+
43,
|
93
|
+
true
|
94
|
+
)
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_3d_big_endian_with_2d_input
|
98
|
+
wkb_tester(
|
99
|
+
'00000000014018000000000000401C000000000000',
|
100
|
+
'POINT(6 7)',
|
101
|
+
3,
|
102
|
+
:xdr,
|
103
|
+
43,
|
104
|
+
false
|
105
|
+
)
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_3d_big_endian_with_2d_input_with_srid
|
109
|
+
wkb_tester(
|
110
|
+
'00200000010000002B4018000000000000401C000000000000',
|
111
|
+
'POINT(6 7)',
|
112
|
+
3,
|
113
|
+
:xdr,
|
114
|
+
43,
|
115
|
+
true
|
116
|
+
)
|
117
|
+
end
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
def test_2d_little_endian_with_3d_input
|
122
|
+
wkb_tester(
|
123
|
+
'010100000000000000000018400000000000001C40',
|
124
|
+
'POINT(6 7 8)',
|
125
|
+
2,
|
126
|
+
:ndr,
|
127
|
+
53,
|
128
|
+
false
|
129
|
+
)
|
130
|
+
end
|
131
|
+
|
132
|
+
def test_2d_little_endian_with_3d_input_with_srid
|
133
|
+
wkb_tester(
|
134
|
+
'01010000203500000000000000000018400000000000001C40',
|
135
|
+
'POINT(6 7 8)',
|
136
|
+
2,
|
137
|
+
:ndr,
|
138
|
+
53,
|
139
|
+
true
|
140
|
+
)
|
141
|
+
end
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
def test_2d_big_endian_with_3d_input
|
146
|
+
wkb_tester(
|
147
|
+
'00000000014018000000000000401C000000000000',
|
148
|
+
'POINT(6 7 8)',
|
149
|
+
2,
|
150
|
+
:xdr,
|
151
|
+
53,
|
152
|
+
false
|
153
|
+
)
|
154
|
+
end
|
155
|
+
|
156
|
+
def test_2d_big_endian_with_3d_input_with_srid
|
157
|
+
wkb_tester(
|
158
|
+
'0020000001000000354018000000000000401C000000000000',
|
159
|
+
'POINT(6 7 8)',
|
160
|
+
2,
|
161
|
+
:xdr,
|
162
|
+
53,
|
163
|
+
true
|
164
|
+
)
|
165
|
+
end
|
166
|
+
|
167
|
+
def test_3d_little_endian_with_3d_input
|
168
|
+
wkb_tester(
|
169
|
+
'010100008000000000000018400000000000001C400000000000002040',
|
170
|
+
'POINT(6 7 8)',
|
171
|
+
3,
|
172
|
+
:ndr,
|
173
|
+
53,
|
174
|
+
false
|
175
|
+
)
|
176
|
+
end
|
177
|
+
|
178
|
+
def test_3d_big_endian_with_3d_input
|
179
|
+
wkb_tester(
|
180
|
+
'00800000014018000000000000401C0000000000004020000000000000',
|
181
|
+
'POINT(6 7 8)',
|
182
|
+
3,
|
183
|
+
:xdr,
|
184
|
+
53,
|
185
|
+
false
|
186
|
+
)
|
187
|
+
end
|
188
|
+
|
189
|
+
def test_3d_big_endian_with_3d_input_with_srid
|
190
|
+
wkb_tester(
|
191
|
+
'00A0000001000000354018000000000000401C0000000000004020000000000000',
|
192
|
+
'POINT(6 7 8)',
|
193
|
+
3,
|
194
|
+
:xdr,
|
195
|
+
53,
|
196
|
+
true
|
197
|
+
)
|
198
|
+
end
|
199
|
+
|
200
|
+
def test_try_bad_byte_order_value
|
201
|
+
assert_raise(TypeError) do
|
202
|
+
wkb_tester(
|
203
|
+
'010100008000000000000018400000000000001C400000000000002040',
|
204
|
+
'POINT(6 7 8)',
|
205
|
+
3,
|
206
|
+
'gibberish',
|
207
|
+
53,
|
208
|
+
false
|
209
|
+
)
|
210
|
+
end
|
211
|
+
|
212
|
+
assert_raise(TypeError) do
|
213
|
+
wkb_tester(
|
214
|
+
'010100008000000000000018400000000000001C400000000000002040',
|
215
|
+
'POINT(6 7 8)',
|
216
|
+
3,
|
217
|
+
1000,
|
218
|
+
53,
|
219
|
+
false
|
220
|
+
)
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
def test_2d_little_endian_binary
|
225
|
+
wkb_tester(
|
226
|
+
'010100000000000000000018400000000000001C40',
|
227
|
+
'POINT(6 7)',
|
228
|
+
2,
|
229
|
+
1,
|
230
|
+
43,
|
231
|
+
false
|
232
|
+
)
|
233
|
+
end
|
234
|
+
|
235
|
+
def test_2d_little_endian_with_srid_binary
|
236
|
+
wkb_tester(
|
237
|
+
'01010000202B00000000000000000018400000000000001C40',
|
238
|
+
'POINT(6 7)',
|
239
|
+
2,
|
240
|
+
1,
|
241
|
+
43,
|
242
|
+
true
|
243
|
+
)
|
244
|
+
end
|
245
|
+
|
246
|
+
def test_2d_big_endian_binary
|
247
|
+
wkb_tester(
|
248
|
+
'00000000014018000000000000401C000000000000',
|
249
|
+
'POINT(6 7)',
|
250
|
+
2,
|
251
|
+
0,
|
252
|
+
43,
|
253
|
+
false
|
254
|
+
)
|
255
|
+
end
|
256
|
+
|
257
|
+
def test_2d_big_endian_with_srid_binary
|
258
|
+
wkb_tester(
|
259
|
+
'00200000010000002B4018000000000000401C000000000000',
|
260
|
+
'POINT(6 7)',
|
261
|
+
2,
|
262
|
+
0,
|
263
|
+
43,
|
264
|
+
true
|
265
|
+
)
|
266
|
+
end
|
267
|
+
|
268
|
+
def test_3d_little_endian_with_2d_output_binary
|
269
|
+
wkb_tester(
|
270
|
+
'010100000000000000000018400000000000001C40',
|
271
|
+
'POINT(6 7)',
|
272
|
+
3,
|
273
|
+
1,
|
274
|
+
43,
|
275
|
+
false
|
276
|
+
)
|
277
|
+
end
|
278
|
+
|
279
|
+
def test_3d_little_endian__with_2d_output_with_srid_binary
|
280
|
+
wkb_tester(
|
281
|
+
'01010000202B00000000000000000018400000000000001C40',
|
282
|
+
'POINT(6 7)',
|
283
|
+
3,
|
284
|
+
1,
|
285
|
+
43,
|
286
|
+
true
|
287
|
+
)
|
288
|
+
end
|
289
|
+
|
290
|
+
def test_3d_big_endian_with_2d_input_binary
|
291
|
+
wkb_tester(
|
292
|
+
'00000000014018000000000000401C000000000000',
|
293
|
+
'POINT(6 7)',
|
294
|
+
3,
|
295
|
+
0,
|
296
|
+
43,
|
297
|
+
false
|
298
|
+
)
|
299
|
+
end
|
300
|
+
|
301
|
+
def test_3d_big_endian_with_2d_input_with_srid_binary
|
302
|
+
wkb_tester(
|
303
|
+
'00200000010000002B4018000000000000401C000000000000',
|
304
|
+
'POINT(6 7)',
|
305
|
+
3,
|
306
|
+
0,
|
307
|
+
43,
|
308
|
+
true
|
309
|
+
)
|
310
|
+
end
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
def test_2d_little_endian_with_3d_input_binary
|
315
|
+
wkb_tester(
|
316
|
+
'010100000000000000000018400000000000001C40',
|
317
|
+
'POINT(6 7 8)',
|
318
|
+
2,
|
319
|
+
1,
|
320
|
+
53,
|
321
|
+
false
|
322
|
+
)
|
323
|
+
end
|
324
|
+
|
325
|
+
def test_2d_little_endian_with_3d_input_with_srid_binary
|
326
|
+
wkb_tester(
|
327
|
+
'01010000203500000000000000000018400000000000001C40',
|
328
|
+
'POINT(6 7 8)',
|
329
|
+
2,
|
330
|
+
1,
|
331
|
+
53,
|
332
|
+
true
|
333
|
+
)
|
334
|
+
end
|
335
|
+
|
336
|
+
def test_2d_big_endian_with_3d_input_binary
|
337
|
+
wkb_tester(
|
338
|
+
"\x00\x00\x00\x00\x01\x40\x18\x00\x00\x00\x00\x00\x00\x40\x1C\x00\x00\x00\x00\x00\x00",
|
339
|
+
'POINT(6 7 8)',
|
340
|
+
2,
|
341
|
+
0,
|
342
|
+
53,
|
343
|
+
false,
|
344
|
+
false
|
345
|
+
)
|
346
|
+
end
|
347
|
+
|
348
|
+
def test_2d_big_endian_with_3d_input_with_srid_binary
|
349
|
+
wkb_tester(
|
350
|
+
"\x00\x20\x00\x00\x01\x00\x00\x00\x35\x40\x18\x00\x00\x00\x00\x00\x00\x40\x1C\x00\x00\x00\x00\x00\x00",
|
351
|
+
'POINT(6 7 8)',
|
352
|
+
2,
|
353
|
+
0,
|
354
|
+
53,
|
355
|
+
true,
|
356
|
+
false
|
357
|
+
)
|
358
|
+
end
|
359
|
+
|
360
|
+
def test_3d_little_endian_with_3d_input_binary
|
361
|
+
wkb_tester(
|
362
|
+
"\x01\x01\x00\x00\x80\x00\x00\x00\x00\x00\x00\x18\x40\x00\x00\x00\x00\x00\x00\x1C\x40\x00\x00\x00\x00\x00\x00\x20\x40",
|
363
|
+
'POINT(6 7 8)',
|
364
|
+
3,
|
365
|
+
1,
|
366
|
+
53,
|
367
|
+
false,
|
368
|
+
false
|
369
|
+
)
|
370
|
+
end
|
371
|
+
|
372
|
+
def test_3d_big_endian_with_3d_input_binary
|
373
|
+
wkb_tester(
|
374
|
+
"\x00\x80\x00\x00\x01\x40\x18\x00\x00\x00\x00\x00\x00\x40\x1C\x00\x00\x00\x00\x00\x00\x40\x20\x00\x00\x00\x00\x00\x00",
|
375
|
+
'POINT(6 7 8)',
|
376
|
+
3,
|
377
|
+
0,
|
378
|
+
53,
|
379
|
+
false,
|
380
|
+
false
|
381
|
+
)
|
382
|
+
end
|
383
|
+
|
384
|
+
def test_3d_big_endian_with_3d_input_with_srid_binary
|
385
|
+
wkb_tester(
|
386
|
+
"\x00\xA0\x00\x00\x01\x00\x00\x00\x35\x40\x18\x00\x00\x00\x00\x00\x00\x40\x1C\x00\x00\x00\x00\x00\x00\x40\x20\x00\x00\x00\x00\x00\x00",
|
387
|
+
'POINT(6 7 8)',
|
388
|
+
3,
|
389
|
+
0,
|
390
|
+
53,
|
391
|
+
true,
|
392
|
+
false
|
393
|
+
)
|
394
|
+
end
|
395
|
+
|
396
|
+
def test_try_bad_byte_order_value_binary
|
397
|
+
assert_raise(TypeError) do
|
398
|
+
wkb_tester(
|
399
|
+
"\x01\x01\x00\x00\x80\x00\x00\x00\x00\x00\x00\x18\x40\x00\x00\x00\x00\x00\x00\x1C\x40\x00\x00\x00\x00\x00\x00\x20\x40",
|
400
|
+
'POINT(6 7 8)',
|
401
|
+
3,
|
402
|
+
'gibberish',
|
403
|
+
53,
|
404
|
+
false,
|
405
|
+
false
|
406
|
+
)
|
407
|
+
end
|
408
|
+
|
409
|
+
assert_raise(TypeError) do
|
410
|
+
wkb_tester(
|
411
|
+
"\x01\x01\x00\x00\x80\x00\x00\x00\x00\x00\x00\x18\x40\x00\x00\x00\x00\x00\x00\x1C\x40\x00\x00\x00\x00\x00\x00\x20\x40",
|
412
|
+
'POINT(6 7 8)',
|
413
|
+
3,
|
414
|
+
1000,
|
415
|
+
53,
|
416
|
+
false,
|
417
|
+
false
|
418
|
+
)
|
419
|
+
end
|
420
|
+
end
|
421
|
+
|
422
|
+
if ENV['FORCE_TESTS'] || defined?(Geos::FFIGeos)
|
423
|
+
def test_write_with_options
|
424
|
+
geom = read('POINT(1 2 3)')
|
425
|
+
geom.srid = 4326
|
426
|
+
|
427
|
+
|
428
|
+
assert_equal('0101000020E6100000000000000000F03F0000000000000040', @wkb_writer.write_hex(geom, {
|
429
|
+
:include_srid => true
|
430
|
+
}))
|
431
|
+
|
432
|
+
assert_equal('0101000000000000000000F03F0000000000000040', @wkb_writer.write_hex(geom))
|
433
|
+
end
|
434
|
+
end
|
435
|
+
end
|