GeoRuby 0.0.4 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,22 +10,24 @@ class TestSimpleFeatures < Test::Unit::TestCase
10
10
  def test_geometry_creation
11
11
  geometry = Geometry::new
12
12
  assert_equal(DEFAULT_SRID,geometry.srid)
13
-
13
+
14
14
  geometry = Geometry::new(225)
15
15
  assert_equal(225,geometry.srid)
16
16
 
17
- point = Geometry.from_hexewkb("01010000207B000000CDCCCCCCCCCC28406666666666A64640")
17
+ point = Geometry.from_hex_ewkb("01010000207B000000CDCCCCCCCCCC28406666666666A64640")
18
18
  assert_equal(Point,point.class)
19
19
  assert_equal(12.4,point.x)
20
-
21
-
20
+
22
21
  end
23
22
  def test_point_creation
24
23
  point= Point::new(456)
25
24
  assert_equal(456,point.srid)
25
+ assert(!point.with_z)
26
+ assert(!point.with_m)
26
27
  assert_equal(0.0,point.x)
27
28
  assert_equal(0.0,point.y)
28
- assert_nil(point.z)
29
+ assert_equal(0.0,point.z)
30
+ assert_equal(0.0,point.m)
29
31
 
30
32
  point.set_x_y_z(2.6,56.6,12)
31
33
  assert_equal(2.6,point.x)
@@ -35,19 +37,31 @@ class TestSimpleFeatures < Test::Unit::TestCase
35
37
  point= Point.from_coordinates([1.6,2.8],123)
36
38
  assert_equal(1.6,point.x)
37
39
  assert_equal(2.8,point.y)
38
- assert_nil(point.z)
40
+ assert(!point.with_z)
41
+ assert_equal(0.0,point.z)
39
42
  assert_equal(123,point.srid)
40
43
 
41
- point=Point.from_coordinates([1.6,2.8,3.4],123)
44
+ point=Point.from_coordinates([1.6,2.8,3.4],123,true)
42
45
  assert_equal(1.6,point.x)
43
46
  assert_equal(2.8,point.y)
47
+ assert(point.with_z)
44
48
  assert_equal(3.4,point.z)
45
49
  assert_equal(123,point.srid)
46
50
 
51
+ point=Point.from_coordinates([1.6,2.8,3.4,15],DEFAULT_SRID,true,true)
52
+ assert_equal(1.6,point.x)
53
+ assert_equal(2.8,point.y)
54
+ assert(point.with_z)
55
+ assert_equal(3.4,point.z)
56
+ assert(point.with_m)
57
+ assert_equal(15,point.m)
58
+ assert_equal(DEFAULT_SRID,point.srid)
59
+
47
60
  point= Point.from_x_y(1.6,2.8,123)
48
61
  assert_equal(1.6,point.x)
49
62
  assert_equal(2.8,point.y)
50
- assert_nil(point.z)
63
+ assert(!point.with_z)
64
+ assert_equal(0,point.z)
51
65
  assert_equal(123,point.srid)
52
66
 
53
67
  point= Point.from_x_y_z(-1.6,2.8,-3.4,123)
@@ -55,7 +69,21 @@ class TestSimpleFeatures < Test::Unit::TestCase
55
69
  assert_equal(2.8,point.y)
56
70
  assert_equal(-3.4,point.z)
57
71
  assert_equal(123,point.srid)
72
+
73
+ point= Point.from_x_y_m(-1.6,2.8,-3.4,123)
74
+ assert_equal(-1.6,point.x)
75
+ assert_equal(2.8,point.y)
76
+ assert_equal(-3.4,point.m)
77
+ assert_equal(123,point.srid)
78
+
79
+ point= Point.from_x_y_z_m(-1.6,2.8,-3.4,15,123)
80
+ assert_equal(-1.6,point.x)
81
+ assert_equal(2.8,point.y)
82
+ assert_equal(-3.4,point.z)
83
+ assert_equal(15,point.m)
84
+ assert_equal(123,point.srid)
58
85
  end
86
+
59
87
  def test_point_equal
60
88
  point1= Point::new
61
89
  point1.set_x_y(1.5,45.4)
@@ -65,29 +93,45 @@ class TestSimpleFeatures < Test::Unit::TestCase
65
93
  point3.set_x_y(4.5,12.3)
66
94
  point4= Point::new
67
95
  point4.set_x_y_z(1.5,45.4,423)
96
+ point5= Point::new
97
+ point5.set_x_y(1.5,45.4)
98
+ point5.m=15
68
99
  geometry= Geometry::new
69
100
 
70
101
  assert(point1==point2)
71
102
  assert(point1!=point3)
72
103
  assert(point1!=point4)
104
+ assert(point1!=point5)
73
105
  assert(point1!=geometry)
74
106
  end
107
+
75
108
  def test_point_binary
76
109
  point = Point.from_x_y(12.4,45.3,123)
77
- #test value is the result of "select 'SRID=123;POINT(12.4 45.3)'::geometry;" in PostGIS
78
- assert_equal("01010000207B000000CDCCCCCCCCCC28406666666666A64640", point.as_hex_binary)
110
+ assert_equal("01010000207B000000CDCCCCCCCCCC28406666666666A64640", point.as_hex_ewkb)
79
111
 
80
112
  point = Point.from_x_y_z(12.4,45.3,-3.5,123)
81
- #test value is the result of "select 'SRID=123;POINT(12.4 45.3 -3.5)'::geometry;" in PostGIS
82
- assert_equal("01010000A07B000000CDCCCCCCCCCC28406666666666A646400000000000000CC0", point.as_hex_binary(3))
113
+ assert_equal("01010000A07B000000CDCCCCCCCCCC28406666666666A646400000000000000CC0", point.as_hex_ewkb)
114
+
115
+ point = Point.from_x_y_z_m(12.4,45.3,-3.5,15,123)
116
+ assert_equal("01010000E07B000000CDCCCCCCCCCC28406666666666A646400000000000000CC00000000000002E40", point.as_hex_ewkb)
117
+
118
+ assert_equal("0101000000CDCCCCCCCCCC28406666666666A64640", point.as_hex_wkb)
83
119
  end
120
+
84
121
  def test_point_text
85
122
  point = Point.from_x_y(12.4,45.3,123)
86
- assert_equal("SRID=123;POINT(12.4 45.3)", point.as_text)
123
+ assert_equal("SRID=123;POINT(12.4 45.3)", point.as_ewkt)
87
124
 
88
125
  point = Point.from_x_y_z(12.4,45.3,-3.5,123)
89
- assert_equal("SRID=123;POINT(12.4 45.3 -3.5)", point.as_text(3))
126
+ assert_equal("SRID=123;POINT(12.4 45.3 -3.5)", point.as_ewkt)
127
+ assert_equal("POINT(12.4 45.3)", point.as_wkt)
128
+ assert_equal("POINT(12.4 45.3 -3.5)", point.as_ewkt(false,true))
129
+
130
+ point = Point.from_x_y_m(12.4,45.3,-3.5,123)
131
+ assert_equal("SRID=123;POINTM(12.4 45.3 -3.5)", point.as_ewkt)
132
+ assert_equal("SRID=123;POINT(12.4 45.3)", point.as_ewkt(true,true,false))
90
133
  end
134
+
91
135
  def test_line_string_creation
92
136
  line_string = LineString::new
93
137
  line_string.concat([Point.from_x_y(12.4,45.3),Point.from_x_y(45.4,41.6)])
@@ -113,41 +157,64 @@ class TestSimpleFeatures < Test::Unit::TestCase
113
157
  assert_equal(Point.from_x_y(12.4,-45.3),line_string[0])
114
158
  assert_equal(Point.from_x_y(45.4,41.6),line_string[1])
115
159
 
116
- line_string = LineString.from_raw_point_sequence([[12.4,-45.3],[45.4,41.6],[4.456,1.0698]],123)
160
+ line_string = LineString.from_coordinates([[12.4,-45.3],[45.4,41.6],[4.456,1.0698]],123)
117
161
  assert_equal(LineString,line_string.class)
118
162
  assert_equal(3,line_string.length)
119
163
  assert_equal(Point.from_x_y(12.4,-45.3),line_string[0])
120
164
  assert_equal(Point.from_x_y(45.4,41.6),line_string[1])
165
+
166
+
167
+ line_string = LineString.from_coordinates([[12.4,-45.3,123],[45.4,41.6,333],[4.456,1.0698,987]],123,true)
168
+ assert_equal(LineString,line_string.class)
169
+ assert_equal(3,line_string.length)
170
+ assert_equal(Point.from_x_y_z(12.4,-45.3,123,123),line_string[0])
171
+
172
+ line_string = LineString.from_coordinates([[12.4,-45.3,123],[45.4,41.6,333],[4.456,1.0698,987]],123,true)
173
+ assert_equal(LineString,line_string.class)
174
+ assert_equal(3,line_string.length)
175
+ assert_equal(Point.from_x_y_z(12.4,-45.3,123,123),line_string[0])
176
+
121
177
  end
178
+
122
179
  def test_line_string_equal
123
- line_string1 = LineString.from_raw_point_sequence([[12.4,-45.3],[45.4,41.6],[4.456,1.0698]],123)
124
- line_string2 = LineString.from_raw_point_sequence([[12.4,-45.3],[45.4,41.6]],123)
180
+ line_string1 = LineString.from_coordinates([[12.4,-45.3],[45.4,41.6],[4.456,1.0698]],123)
181
+ line_string2 = LineString.from_coordinates([[12.4,-45.3],[45.4,41.6]],123)
125
182
  point = Point.from_x_y(12.4,-45.3,123)
126
183
 
127
- assert(LineString.from_raw_point_sequence([[12.4,-45.3],[45.4,41.6],[4.456,1.0698]],123) == line_string1)
184
+ assert(LineString.from_coordinates([[12.4,-45.3],[45.4,41.6],[4.456,1.0698]],123) == line_string1)
128
185
  assert(line_string1 != line_string2)
129
186
  assert(line_string1 != point)
130
187
  end
188
+
131
189
  def test_line_string_binary
132
- line_string = LineString.from_raw_point_sequence([[12.4,-45.3],[45.4,41.6]],256)
133
- #test value is the result of "select 'SRID=256;LINESTRING(12.4 -45.3,45.4 41.6)'::geometry;" in PostGIS
134
- assert_equal("01020000200001000002000000CDCCCCCCCCCC28406666666666A646C03333333333B34640CDCCCCCCCCCC4440",line_string.as_hex_binary)
190
+ line_string = LineString.from_coordinates([[12.4,-45.3],[45.4,41.6]],256)
191
+ assert_equal("01020000200001000002000000CDCCCCCCCCCC28406666666666A646C03333333333B34640CDCCCCCCCCCC4440",line_string.as_hex_ewkb)
192
+
193
+ line_string = LineString.from_coordinates([[12.4,-45.3,35.3],[45.4,41.6,12.3]],256,true)
194
+ assert_equal("01020000A00001000002000000CDCCCCCCCCCC28406666666666A646C06666666666A641403333333333B34640CDCCCCCCCCCC44409A99999999992840",line_string.as_hex_ewkb)
135
195
 
136
- line_string = LineString.from_raw_point_sequence([[12.4,-45.3,35.3],[45.4,41.6,12.3]],256)
137
- #test value is the result of "select 'SRID=256;LINESTRING(12.4 -45.3 35.3,45.4 41.6 12.3)'::geometry;" in PostGIS
138
- assert_equal("01020000A00001000002000000CDCCCCCCCCCC28406666666666A646C06666666666A641403333333333B34640CDCCCCCCCCCC44409A99999999992840",line_string.as_hex_binary(3))
196
+ line_string = LineString.from_coordinates([[12.4,-45.3,35.3,45.1],[45.4,41.6,12.3,40.23]],256,true,true)
197
+ assert_equal("01020000E00001000002000000CDCCCCCCCCCC28406666666666A646C06666666666A64140CDCCCCCCCC8C46403333333333B34640CDCCCCCCCCCC44409A999999999928403D0AD7A3701D4440",line_string.as_hex_ewkb)
139
198
  end
199
+
140
200
  def test_line_string_text
141
- line_string = LineString.from_raw_point_sequence([[12.4,-45.3],[45.4,41.6]],256)
142
- assert_equal("SRID=256;LINESTRING(12.4 -45.3,45.4 41.6)",line_string.as_text)
201
+ line_string = LineString.from_coordinates([[12.4,-45.3],[45.4,41.6]],256)
202
+ assert_equal("SRID=256;LINESTRING(12.4 -45.3,45.4 41.6)",line_string.as_ewkt)
203
+
204
+ line_string = LineString.from_coordinates([[12.4,-45.3,35.3],[45.4,41.6,12.3]],256,true)
205
+ assert_equal("SRID=256;LINESTRING(12.4 -45.3 35.3,45.4 41.6 12.3)",line_string.as_ewkt)
206
+
207
+ line_string = LineString.from_coordinates([[12.4,-45.3,35.3],[45.4,41.6,12.3]],256,false,true)
208
+ assert_equal("SRID=256;LINESTRINGM(12.4 -45.3 35.3,45.4 41.6 12.3)",line_string.as_ewkt)
209
+
210
+ line_string = LineString.from_coordinates([[12.4,-45.3,35.3,25.2],[45.4,41.6,12.3,13.75]],256,true,true)
211
+ assert_equal("SRID=256;LINESTRING(12.4 -45.3 35.3 25.2,45.4 41.6 12.3 13.75)",line_string.as_ewkt)
143
212
 
144
- line_string = LineString.from_raw_point_sequence([[12.4,-45.3,35.3],[45.4,41.6,12.3]],256)
145
- assert_equal("SRID=256;LINESTRING(12.4 -45.3 35.3,45.4 41.6 12.3)",line_string.as_text(3))
146
213
  end
147
214
 
148
215
  def test_linear_ring_creation
149
216
  #testing just the constructor helpers since the rest is the same as for line_string
150
- linear_ring = LinearRing.from_raw_point_sequence([[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],345)
217
+ linear_ring = LinearRing.from_coordinates([[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],345)
151
218
  assert_equal(LinearRing,linear_ring.class)
152
219
  assert_equal(4,linear_ring.length)
153
220
  assert(linear_ring.is_closed)
@@ -155,8 +222,8 @@ class TestSimpleFeatures < Test::Unit::TestCase
155
222
  end
156
223
  #no test of the binary representation for linear_rings : always with polygons and like line_string
157
224
  def test_polygon_creation
158
- linear_ring1 = LinearRing.from_raw_point_sequence([[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],256)
159
- linear_ring2 = LinearRing.from_raw_point_sequence([[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]],256)
225
+ linear_ring1 = LinearRing.from_coordinates([[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],256)
226
+ linear_ring2 = LinearRing.from_coordinates([[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]],256)
160
227
 
161
228
  polygon = Polygon::new(256)
162
229
  assert_equal(0,polygon.length)
@@ -176,37 +243,65 @@ class TestSimpleFeatures < Test::Unit::TestCase
176
243
  assert_equal(linear_ring1,polygon[0])
177
244
  assert_equal(linear_ring2,polygon[1])
178
245
 
179
- polygon = Polygon.from_raw_point_sequences([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],256)
246
+ polygon = Polygon.from_coordinates([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],256)
180
247
  assert_equal(Polygon,polygon.class)
181
248
  assert_equal(2,polygon.length)
182
249
  assert_equal(linear_ring1,polygon[0])
183
250
  assert_equal(linear_ring2,polygon[1])
251
+
252
+
253
+ polygon = Polygon.from_coordinates([[[12.4,-45.3,15.2],[45.4,41.6,2.4],[4.456,1.0698,5.6],[12.4,-45.3,6.1]],[[2.4,5.3,4.5],[5.4,1.4263,4.2],[14.46,1.06,123.1],[2.4,5.3,4.4]]],256,true)
254
+ assert_equal(Polygon,polygon.class)
255
+ assert_equal(2,polygon.length)
256
+
257
+ linear_ring1 = LinearRing.from_coordinates([[12.4,-45.3,15.2],[45.4,41.6,2.4],[4.456,1.0698,5.6],[12.4,-45.3,6.1]],256,true)
258
+ linear_ring2 = LinearRing.from_coordinates([[2.4,5.3,4.5],[5.4,1.4263,4.2],[14.46,1.06,123.1],[2.4,5.3,4.4]],256,true)
259
+
260
+ assert_equal(linear_ring1,polygon[0])
261
+ assert_equal(linear_ring2,polygon[1])
262
+
263
+
184
264
  end
185
265
  def test_polygon_equal
186
- polygon1 = Polygon.from_raw_point_sequences([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],256)
187
- polygon2 = Polygon.from_raw_point_sequences([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06]]])
266
+ polygon1 = Polygon.from_coordinates([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],256)
267
+ polygon2 = Polygon.from_coordinates([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06]]])
188
268
  point = Point.from_x_y(12.4,-45.3,123)
189
269
 
190
- assert(polygon1 == Polygon.from_raw_point_sequences([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],256))
270
+ assert(polygon1 == Polygon.from_coordinates([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],256))
191
271
  assert(polygon1 != polygon2)
192
272
  assert(polygon1 != point)
193
273
  end
194
274
  def test_polygon_binary
195
- polygon = Polygon.from_raw_point_sequences([[[0,0],[4,0],[4,4],[0,4],[0,0]],[[1,1],[3,1],[3,3],[1,3],[1,1]]],256)
275
+ polygon = Polygon.from_coordinates([[[0,0],[4,0],[4,4],[0,4],[0,0]],[[1,1],[3,1],[3,3],[1,3],[1,1]]],256)
196
276
  #taken from PostGIS answer
197
- assert_equal("0103000020000100000200000005000000000000000000000000000000000000000000000000001040000000000000000000000000000010400000000000001040000000000000000000000000000010400000000000000000000000000000000005000000000000000000F03F000000000000F03F0000000000000840000000000000F03F00000000000008400000000000000840000000000000F03F0000000000000840000000000000F03F000000000000F03F",polygon.as_hex_binary)
277
+ assert_equal("0103000020000100000200000005000000000000000000000000000000000000000000000000001040000000000000000000000000000010400000000000001040000000000000000000000000000010400000000000000000000000000000000005000000000000000000F03F000000000000F03F0000000000000840000000000000F03F00000000000008400000000000000840000000000000F03F0000000000000840000000000000F03F000000000000F03F",polygon.as_hex_ewkb)
198
278
 
199
- polygon = Polygon.from_raw_point_sequences([[[0,0,2],[4,0,2],[4,4,2],[0,4,2],[0,0,2]],[[1,1,2],[3,1,2],[3,3,2],[1,3,2],[1,1,2]]],256)
279
+ polygon = Polygon.from_coordinates([[[0,0,2],[4,0,2],[4,4,2],[0,4,2],[0,0,2]],[[1,1,2],[3,1,2],[3,3,2],[1,3,2],[1,1,2]]],256,true)
200
280
  #taken from PostGIS answer
201
- assert_equal("01030000A000010000020000000500000000000000000000000000000000000000000000000000004000000000000010400000000000000000000000000000004000000000000010400000000000001040000000000000004000000000000000000000000000001040000000000000004000000000000000000000000000000000000000000000004005000000000000000000F03F000000000000F03F00000000000000400000000000000840000000000000F03F0000000000000040000000000000084000000000000008400000000000000040000000000000F03F00000000000008400000000000000040000000000000F03F000000000000F03F0000000000000040",polygon.as_hex_binary(3));
281
+ assert_equal("01030000A000010000020000000500000000000000000000000000000000000000000000000000004000000000000010400000000000000000000000000000004000000000000010400000000000001040000000000000004000000000000000000000000000001040000000000000004000000000000000000000000000000000000000000000004005000000000000000000F03F000000000000F03F00000000000000400000000000000840000000000000F03F0000000000000040000000000000084000000000000008400000000000000040000000000000F03F00000000000008400000000000000040000000000000F03F000000000000F03F0000000000000040",polygon.as_hex_ewkb);
282
+
283
+
284
+ polygon = Polygon.from_coordinates([[[0,0,2],[4,0,2],[4,4,2],[0,4,2],[0,0,2]],[[1,1,2],[3,1,2],[3,3,2],[1,3,2],[1,1,2]]],256,false,true)
285
+ assert_equal("010300006000010000020000000500000000000000000000000000000000000000000000000000004000000000000010400000000000000000000000000000004000000000000010400000000000001040000000000000004000000000000000000000000000001040000000000000004000000000000000000000000000000000000000000000004005000000000000000000F03F000000000000F03F00000000000000400000000000000840000000000000F03F0000000000000040000000000000084000000000000008400000000000000040000000000000F03F00000000000008400000000000000040000000000000F03F000000000000F03F0000000000000040",polygon.as_hex_ewkb);
286
+
287
+ polygon = Polygon.from_coordinates([[[0,0,2,-45.1],[4,0,2,5],[4,4,2,4.67],[0,4,2,1.34],[0,0,2,-45.1]],[[1,1,2,12.3],[3,1,2,123],[3,3,2,12.2],[1,3,2,12],[1,1,2,12.3]]],256,true,true)
288
+ assert_equal("01030000E0000100000200000005000000000000000000000000000000000000000000000000000040CDCCCCCCCC8C46C00000000000001040000000000000000000000000000000400000000000001440000000000000104000000000000010400000000000000040AE47E17A14AE1240000000000000000000000000000010400000000000000040713D0AD7A370F53F000000000000000000000000000000000000000000000040CDCCCCCCCC8C46C005000000000000000000F03F000000000000F03F00000000000000409A999999999928400000000000000840000000000000F03F00000000000000400000000000C05E400000000000000840000000000000084000000000000000406666666666662840000000000000F03F000000000000084000000000000000400000000000002840000000000000F03F000000000000F03F00000000000000409A99999999992840",polygon.as_hex_ewkb);
289
+
202
290
  end
203
291
  def test_polygon_text
204
- polygon = Polygon.from_raw_point_sequences([[[0,0],[4,0],[4,4],[0,4],[0,0]],[[1,1],[3,1],[3,3],[1,3],[1,1]]],256)
205
- assert_equal("SRID=256;POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1,3 1,3 3,1 3,1 1))",polygon.as_text)
292
+ polygon = Polygon.from_coordinates([[[0,0],[4,0],[4,4],[0,4],[0,0]],[[1,1],[3,1],[3,3],[1,3],[1,1]]],256)
293
+ assert_equal("SRID=256;POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1,3 1,3 3,1 3,1 1))",polygon.as_ewkt)
206
294
 
207
- polygon = Polygon.from_raw_point_sequences([[[0,0,2],[4,0,2],[4,4,2],[0,4,2],[0,0,2]],[[1,1,2],[3,1,2],[3,3,2],[1,3,2],[1,1,2]]],256)
208
- assert_equal("SRID=256;POLYGON((0 0 2,4 0 2,4 4 2,0 4 2,0 0 2),(1 1 2,3 1 2,3 3 2,1 3 2,1 1 2))",polygon.as_text(3));
295
+ polygon = Polygon.from_coordinates([[[0,0,2],[4,0,2],[4,4,2],[0,4,2],[0,0,2]],[[1,1,2],[3,1,2],[3,3,2],[1,3,2],[1,1,2]]],256,true)
296
+ assert_equal("SRID=256;POLYGON((0 0 2,4 0 2,4 4 2,0 4 2,0 0 2),(1 1 2,3 1 2,3 3 2,1 3 2,1 1 2))",polygon.as_ewkt);
297
+
298
+ polygon = Polygon.from_coordinates([[[0,0,2],[4,0,2],[4,4,2],[0,4,2],[0,0,2]],[[1,1,2],[3,1,2],[3,3,2],[1,3,2],[1,1,2]]],256,false,true)
299
+ assert_equal("SRID=256;POLYGONM((0 0 2,4 0 2,4 4 2,0 4 2,0 0 2),(1 1 2,3 1 2,3 3 2,1 3 2,1 1 2))",polygon.as_ewkt);
300
+
301
+ polygon = Polygon.from_coordinates([[[0,0,2,-45.1],[4,0,2,5],[4,4,2,4.67],[0,4,2,1.34],[0,0,2,-45.1]],[[1,1,2,12.3],[3,1,2,123],[3,3,2,12.2],[1,3,2,12],[1,1,2,12.3]]],256,true,true)
302
+ assert_equal("SRID=256;POLYGON((0 0 2 -45.1,4 0 2 5,4 4 2 4.67,0 4 2 1.34,0 0 2 -45.1),(1 1 2 12.3,3 1 2 123,3 3 2 12.2,1 3 2 12,1 1 2 12.3))",polygon.as_ewkt);
209
303
  end
304
+
210
305
  def test_geometry_collection_creation
211
306
  geometry_collection = GeometryCollection::new(256)
212
307
  geometry_collection << Point.from_x_y(4.67,45.4,256)
@@ -214,90 +309,126 @@ class TestSimpleFeatures < Test::Unit::TestCase
214
309
  assert_equal(1,geometry_collection.length)
215
310
  assert_equal(Point.from_x_y(4.67,45.4,256),geometry_collection[0])
216
311
 
217
- geometry_collection[0]=LineString.from_raw_point_sequence([[5.7,12.45],[67.55,54]],256)
218
- geometry_collection << Polygon.from_raw_point_sequences([[[0,0,2],[4,0,2],[4,4,2],[0,4,2],[0,0,2]],[[1,1,2],[3,1,2],[3,3,2],[1,3,2],[1,1,2]]],256)
312
+ geometry_collection[0]=LineString.from_coordinates([[5.7,12.45],[67.55,54]],256)
313
+ geometry_collection << Polygon.from_coordinates([[[0,0],[4,0],[4,4],[0,4],[0,0]],[[1,1],[3,1],[3,3],[1,3],[1,1]]],256)
219
314
  assert_equal(2,geometry_collection.length)
220
- assert_equal(LineString.from_raw_point_sequence([[5.7,12.45],[67.55,54]],256),geometry_collection[0])
315
+ assert_equal(LineString.from_coordinates([[5.7,12.45],[67.55,54]],256),geometry_collection[0])
221
316
 
222
- geometry_collection = GeometryCollection.from_geometries([Point.from_x_y(4.67,45.4,256),LineString.from_raw_point_sequence([[5.7,12.45],[67.55,54]],256)],256)
317
+ geometry_collection = GeometryCollection.from_geometries([Point.from_x_y(4.67,45.4,256),LineString.from_coordinates([[5.7,12.45],[67.55,54]],256)],256)
223
318
  assert_equal(GeometryCollection,geometry_collection.class)
224
319
  assert_equal(256,geometry_collection.srid)
225
320
  assert_equal(2,geometry_collection.length)
226
- assert_equal(LineString.from_raw_point_sequence([[5.7,12.45],[67.55,54]],256),geometry_collection[1])
321
+ assert_equal(LineString.from_coordinates([[5.7,12.45],[67.55,54]],256),geometry_collection[1])
227
322
  end
228
323
  def test_geometry_collection_equal
229
- geometry_collection1 = GeometryCollection.from_geometries([Point.from_x_y(4.67,45.4,256),LineString.from_raw_point_sequence([[5.7,12.45],[67.55,54]],256)],256)
230
- geometry_collection2 = GeometryCollection.from_geometries([Point.from_x_y(4.67,45.4,256),LineString.from_raw_point_sequence([[5.7,12.45],[67.55,54]],256),Polygon.from_raw_point_sequences([[[0,0,2],[4,0,2],[4,4,2],[0,4,2],[0,0,2]],[[1,1,2],[3,1,2],[3,3,2],[1,3,2],[1,1,2]]],256)],256)
231
- line_string=LineString.from_raw_point_sequence([[5.7,12.45],[67.55,54]],256)
324
+ geometry_collection1 = GeometryCollection.from_geometries([Point.from_x_y(4.67,45.4,256),LineString.from_coordinates([[5.7,12.45],[67.55,54]],256)],256)
325
+ geometry_collection2 = GeometryCollection.from_geometries([Point.from_x_y(4.67,45.4,256),LineString.from_coordinates([[5.7,12.45],[67.55,54]],256),Polygon.from_coordinates([[[0,0,2],[4,0,2],[4,4,2],[0,4,2],[0,0,2]],[[1,1,2],[3,1,2],[3,3,2],[1,3,2],[1,1,2]]],256)],256,true)
326
+ line_string=LineString.from_coordinates([[5.7,12.45],[67.55,54]],256)
232
327
 
233
- assert(GeometryCollection.from_geometries([Point.from_x_y(4.67,45.4,256),LineString.from_raw_point_sequence([[5.7,12.45],[67.55,54]],256)],256) == geometry_collection1)
328
+ assert(GeometryCollection.from_geometries([Point.from_x_y(4.67,45.4,256),LineString.from_coordinates([[5.7,12.45],[67.55,54]],256)],256) == geometry_collection1)
234
329
  assert(geometry_collection1 != geometry_collection2)
235
330
  assert(geometry_collection1 != line_string)
236
331
  end
237
332
  def test_geometry_collection_binary
238
- geometry_collection = GeometryCollection.from_geometries([Point.from_x_y(4.67,45.4,256),LineString.from_raw_point_sequence([[5.7,12.45],[67.55,54]],256)],256)
239
- assert_equal("010700002000010000020000000101000000AE47E17A14AE12403333333333B34640010200000002000000CDCCCCCCCCCC16406666666666E628403333333333E350400000000000004B40",geometry_collection.as_hex_binary)
333
+ geometry_collection = GeometryCollection.from_geometries([Point.from_x_y(4.67,45.4,256),LineString.from_coordinates([[5.7,12.45],[67.55,54]],256)],256)
334
+ assert_equal("010700002000010000020000000101000000AE47E17A14AE12403333333333B34640010200000002000000CDCCCCCCCCCC16406666666666E628403333333333E350400000000000004B40",geometry_collection.as_hex_ewkb)
335
+
336
+ geometry_collection = GeometryCollection.from_geometries([Point.from_x_y_z_m(4.67,45.4,45.67,2.3,256),LineString.from_coordinates([[5.7,12.45,4.56,98.3],[67.55,54,12.2,3.4]],256,true, true)],256,true, true)
337
+ assert_equal("01070000E0000100000200000001010000C0AE47E17A14AE12403333333333B34640F6285C8FC2D54640666666666666024001020000C002000000CDCCCCCCCCCC16406666666666E628403D0AD7A3703D124033333333339358403333333333E350400000000000004B4066666666666628403333333333330B40",geometry_collection.as_hex_ewkb)
338
+
240
339
  end
241
340
  def test_geometry_collection_text
242
- geometry_collection = GeometryCollection.from_geometries([Point.from_x_y(4.67,45.4,256),LineString.from_raw_point_sequence([[5.7,12.45],[67.55,54]],256)],256)
243
- assert_equal("SRID=256;GEOMETRYCOLLECTION(POINT(4.67 45.4),LINESTRING(5.7 12.45,67.55 54))",geometry_collection.as_text)
341
+ geometry_collection = GeometryCollection.from_geometries([Point.from_x_y(4.67,45.4,256),LineString.from_coordinates([[5.7,12.45],[67.55,54]],256)],256)
342
+ assert_equal("SRID=256;GEOMETRYCOLLECTION(POINT(4.67 45.4),LINESTRING(5.7 12.45,67.55 54))",geometry_collection.as_ewkt)
343
+
344
+ geometry_collection = GeometryCollection.from_geometries([Point.from_x_y_m(4.67,45.4,45.6,256),LineString.from_coordinates([[5.7,12.45,5.6],[67.55,54,6.7]],256,false,true)],256,false,true)
345
+ assert_equal("SRID=256;GEOMETRYCOLLECTIONM(POINTM(4.67 45.4 45.6),LINESTRINGM(5.7 12.45 5.6,67.55 54 6.7))",geometry_collection.as_ewkt)
346
+
244
347
  end
245
348
  def test_multi_point_creation
246
- multi_point = MultiPoint.from_raw_point_sequence([[12.4,-123.3],[-65.1,123.4],[123.55555555,123]],444)
349
+ multi_point = MultiPoint.from_coordinates([[12.4,-123.3],[-65.1,123.4],[123.55555555,123]],444)
247
350
  assert(multi_point.instance_of?(MultiPoint))
248
351
  assert_equal(3,multi_point.length)
249
352
  assert_equal(Point.from_x_y(12.4,-123.3,444),multi_point[0])
250
353
  assert_equal(Point.from_x_y(123.55555555,123,444),multi_point[2])
251
354
  end
252
355
  def test_multi_point_binary
253
- multi_point = MultiPoint.from_raw_point_sequence([[12.4,-123.3],[-65.1,123.4],[123.55555555,123]],444)
254
- assert_equal("0104000020BC010000030000000101000000CDCCCCCCCCCC28403333333333D35EC0010100000066666666664650C09A99999999D95E4001010000001F97DD388EE35E400000000000C05E40",multi_point.as_hex_binary)
356
+ multi_point = MultiPoint.from_coordinates([[12.4,-123.3],[-65.1,123.4],[123.55555555,123]],444)
357
+ assert_equal("0104000020BC010000030000000101000000CDCCCCCCCCCC28403333333333D35EC0010100000066666666664650C09A99999999D95E4001010000001F97DD388EE35E400000000000C05E40",multi_point.as_hex_ewkb)
358
+
359
+ multi_point = MultiPoint.from_coordinates([[12.4,-123.3,4.5],[-65.1,123.4,1.2],[123.55555555,123,2.3]],444,true)
360
+ assert_equal("01040000A0BC010000030000000101000080CDCCCCCCCCCC28403333333333D35EC00000000000001240010100008066666666664650C09A99999999D95E40333333333333F33F01010000801F97DD388EE35E400000000000C05E406666666666660240",multi_point.as_hex_ewkb)
361
+
362
+
255
363
  end
256
364
  def test_multi_point_text
257
- multi_point = MultiPoint.from_raw_point_sequence([[12.4,-123.3],[-65.1,123.4],[123.55555555,123]],444)
258
- assert_equal("SRID=444;MULTIPOINT(12.4 -123.3,-65.1 123.4,123.55555555 123)",multi_point.as_text)
365
+ multi_point = MultiPoint.from_coordinates([[12.4,-123.3],[-65.1,123.4],[123.55555555,123]],444)
366
+ assert_equal("SRID=444;MULTIPOINT(12.4 -123.3,-65.1 123.4,123.55555555 123)",multi_point.as_ewkt)
367
+
368
+ multi_point = MultiPoint.from_coordinates([[12.4,-123.3,4.5],[-65.1,123.4,6.7],[123.55555555,123,7.8]],444,true)
369
+ assert_equal("SRID=444;MULTIPOINT(12.4 -123.3 4.5,-65.1 123.4 6.7,123.55555555 123 7.8)",multi_point.as_ewkt)
370
+
371
+
259
372
  end
373
+
260
374
  def test_multi_line_string_creation
261
- multi_line_string1 = MultiLineString.from_line_strings([LineString.from_raw_point_sequence([[1.5,45.2],[-54.12312,-0.012]],256),LineString.from_raw_point_sequence([[1.5,45.2],[-54.12312,-0.012],[45.123,123.3]],256)],256)
375
+ multi_line_string1 = MultiLineString.from_line_strings([LineString.from_coordinates([[1.5,45.2],[-54.12312,-0.012]],256),LineString.from_coordinates([[1.5,45.2],[-54.12312,-0.012],[45.123,123.3]],256)],256)
262
376
  assert(multi_line_string1.instance_of?(MultiLineString))
263
377
  assert_equal(2,multi_line_string1.length)
264
- assert_equal(LineString.from_raw_point_sequence([[1.5,45.2],[-54.12312,-0.012]],256),multi_line_string1[0])
378
+ assert_equal(LineString.from_coordinates([[1.5,45.2],[-54.12312,-0.012]],256),multi_line_string1[0])
265
379
 
266
- multi_line_string2= MultiLineString.from_raw_point_sequences([[[1.5,45.2],[-54.12312,-0.012]],[[1.5,45.2],[-54.12312,-0.012],[45.123,123.3]]],256);
380
+ multi_line_string2= MultiLineString.from_coordinates([[[1.5,45.2],[-54.12312,-0.012]],[[1.5,45.2],[-54.12312,-0.012],[45.123,123.3]]],256);
267
381
  assert(multi_line_string2.instance_of?(MultiLineString))
268
382
  assert_equal(2,multi_line_string2.length)
269
- assert_equal(LineString.from_raw_point_sequence([[1.5,45.2],[-54.12312,-0.012]],256),multi_line_string2[0])
383
+ assert_equal(LineString.from_coordinates([[1.5,45.2],[-54.12312,-0.012]],256),multi_line_string2[0])
270
384
  assert(multi_line_string2 == multi_line_string2)
271
385
  end
386
+
272
387
  def test_multi_line_string_binary
273
- multi_line_string = MultiLineString.from_line_strings([LineString.from_raw_point_sequence([[1.5,45.2],[-54.12312,-0.012]],256),LineString.from_raw_point_sequence([[1.5,45.2],[-54.12312,-0.012],[45.123,123.3]],256)],256)
388
+ multi_line_string = MultiLineString.from_line_strings([LineString.from_coordinates([[1.5,45.2],[-54.12312,-0.012]],256),LineString.from_coordinates([[1.5,45.2],[-54.12312,-0.012],[45.123,123.3]],256)],256)
389
+ assert_equal("01050000200001000002000000010200000002000000000000000000F83F9A99999999994640E4BD6A65C20F4BC0FA7E6ABC749388BF010200000003000000000000000000F83F9A99999999994640E4BD6A65C20F4BC0FA7E6ABC749388BF39B4C876BE8F46403333333333D35E40",multi_line_string.as_hex_ewkb)
274
390
 
275
- assert_equal("01050000200001000002000000010200000002000000000000000000F83F9A99999999994640E4BD6A65C20F4BC0FA7E6ABC749388BF010200000003000000000000000000F83F9A99999999994640E4BD6A65C20F4BC0FA7E6ABC749388BF39B4C876BE8F46403333333333D35E40",multi_line_string.as_hex_binary)
391
+ multi_line_string = MultiLineString.from_line_strings([LineString.from_coordinates([[1.5,45.2,1.3,1.2],[-54.12312,-0.012,1.2,4.5]],256,true,true),LineString.from_coordinates([[1.5,45.2,5.1,-4.5],[-54.12312,-0.012,-6.8,3.4],[45.123,123.3,4.5,-5.3]],256,true,true)],256,true,true)
392
+ assert_equal("0105000020000100000200000001020000C002000000000000000000F83F9A99999999994640CDCCCCCCCCCCF43F333333333333F33FE4BD6A65C20F4BC0FA7E6ABC749388BF333333333333F33F000000000000124001020000C003000000000000000000F83F9A99999999994640666666666666144000000000000012C0E4BD6A65C20F4BC0FA7E6ABC749388BF3333333333331BC03333333333330B4039B4C876BE8F46403333333333D35E40000000000000124033333333333315C0",multi_line_string.as_hex_ewkb)
276
393
  end
394
+
277
395
  def test_multi_line_string_text
278
- multi_line_string = MultiLineString.from_line_strings([LineString.from_raw_point_sequence([[1.5,45.2],[-54.12312,-0.012]],256),LineString.from_raw_point_sequence([[1.5,45.2],[-54.12312,-0.012],[45.123,123.3]],256)],256)
279
- assert_equal("SRID=256;MULTILINESTRING((1.5 45.2,-54.12312 -0.012),(1.5 45.2,-54.12312 -0.012,45.123 123.3))",multi_line_string.as_text)
396
+ multi_line_string = MultiLineString.from_line_strings([LineString.from_coordinates([[1.5,45.2],[-54.12312,-0.012]],256),LineString.from_coordinates([[1.5,45.2],[-54.12312,-0.012],[45.123,123.3]],256)],256)
397
+ assert_equal("SRID=256;MULTILINESTRING((1.5 45.2,-54.12312 -0.012),(1.5 45.2,-54.12312 -0.012,45.123 123.3))",multi_line_string.as_ewkt)
398
+
399
+ multi_line_string = MultiLineString.from_line_strings([LineString.from_coordinates([[1.5,45.2,1.3,1.2],[-54.12312,-0.012,1.2,4.5]],256,true,true),LineString.from_coordinates([[1.5,45.2,5.1,-4.5],[-54.12312,-0.012,-6.8,3.4],[45.123,123.3,4.5,-5.3]],256,true,true)],256,true,true)
400
+ assert_equal("SRID=256;MULTILINESTRING((1.5 45.2 1.3 1.2,-54.12312 -0.012 1.2 4.5),(1.5 45.2 5.1 -4.5,-54.12312 -0.012 -6.8 3.4,45.123 123.3 4.5 -5.3))",multi_line_string.as_ewkt)
401
+
280
402
  end
281
403
 
282
404
  def test_multi_polygon_creation
283
- multi_polygon1 = MultiPolygon.from_polygons([Polygon.from_raw_point_sequences([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],256),Polygon.from_raw_point_sequences([[[0,0],[4,0],[4,4],[0,4],[0,0]],[[1,1],[3,1],[3,3],[1,3],[1,1]]],256)],256)
405
+ multi_polygon1 = MultiPolygon.from_polygons([Polygon.from_coordinates([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],256),Polygon.from_coordinates([[[0,0],[4,0],[4,4],[0,4],[0,0]],[[1,1],[3,1],[3,3],[1,3],[1,1]]],256)],256)
284
406
  assert(multi_polygon1.instance_of?(MultiPolygon))
285
407
  assert_equal(2,multi_polygon1.length)
286
- assert_equal(Polygon.from_raw_point_sequences([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],256),multi_polygon1[0])
408
+ assert_equal(Polygon.from_coordinates([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],256),multi_polygon1[0])
287
409
 
288
- multi_polygon2 = MultiPolygon.from_raw_point_sequences([[[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],[[[0,0],[4,0],[4,4],[0,4],[0,0]],[[1,1],[3,1],[3,3],[1,3],[1,1]]]],256)
410
+ multi_polygon2 = MultiPolygon.from_coordinates([[[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],[[[0,0],[4,0],[4,4],[0,4],[0,0]],[[1,1],[3,1],[3,3],[1,3],[1,1]]]],256)
289
411
  assert(multi_polygon2.instance_of?(MultiPolygon))
290
412
  assert_equal(2,multi_polygon2.length)
291
- assert_equal(Polygon.from_raw_point_sequences([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],256),multi_polygon2[0])
413
+ assert_equal(Polygon.from_coordinates([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],256),multi_polygon2[0])
292
414
  assert(multi_polygon1 == multi_polygon2)
293
415
  end
416
+
294
417
  def test_multi_polygon_binary
295
- multi_polygon = MultiPolygon.from_polygons([Polygon.from_raw_point_sequences([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],256),Polygon.from_raw_point_sequences([[[0,0],[4,0],[4,4],[0,4],[0,0]],[[1,1],[3,1],[3,3],[1,3],[1,1]]],256)],256)
296
- assert_equal("0106000020000100000200000001030000000200000004000000CDCCCCCCCCCC28406666666666A646C03333333333B34640CDCCCCCCCCCC44406DE7FBA9F1D211403D2CD49AE61DF13FCDCCCCCCCCCC28406666666666A646C004000000333333333333034033333333333315409A999999999915408A8EE4F21FD2F63FEC51B81E85EB2C40F6285C8FC2F5F03F3333333333330340333333333333154001030000000200000005000000000000000000000000000000000000000000000000001040000000000000000000000000000010400000000000001040000000000000000000000000000010400000000000000000000000000000000005000000000000000000F03F000000000000F03F0000000000000840000000000000F03F00000000000008400000000000000840000000000000F03F0000000000000840000000000000F03F000000000000F03F",multi_polygon.as_hex_binary)
418
+ multi_polygon = MultiPolygon.from_polygons([Polygon.from_coordinates([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],256),Polygon.from_coordinates([[[0,0],[4,0],[4,4],[0,4],[0,0]],[[1,1],[3,1],[3,3],[1,3],[1,1]]],256)],256)
419
+ assert_equal("0106000020000100000200000001030000000200000004000000CDCCCCCCCCCC28406666666666A646C03333333333B34640CDCCCCCCCCCC44406DE7FBA9F1D211403D2CD49AE61DF13FCDCCCCCCCCCC28406666666666A646C004000000333333333333034033333333333315409A999999999915408A8EE4F21FD2F63FEC51B81E85EB2C40F6285C8FC2F5F03F3333333333330340333333333333154001030000000200000005000000000000000000000000000000000000000000000000001040000000000000000000000000000010400000000000001040000000000000000000000000000010400000000000000000000000000000000005000000000000000000F03F000000000000F03F0000000000000840000000000000F03F00000000000008400000000000000840000000000000F03F0000000000000840000000000000F03F000000000000F03F",multi_polygon.as_hex_ewkb)
420
+
421
+ multi_polygon = MultiPolygon.from_polygons([Polygon.from_coordinates([[[12.4,-45.3,1.2],[45.4,41.6,1.2],[4.456,1.0698,1.2],[12.4,-45.3,1.2]],[[2.4,5.3,1.2],[5.4,1.4263,1.2],[14.46,1.06,1.2],[2.4,5.3,1.2]]],256,false,true),Polygon.from_coordinates([[[0,0,1.2],[4,0,1.2],[4,4,2.3],[0,4,1.2],[0,0,1.2]],[[1,1,2.2],[3,1,3.3],[3,3,1.1],[1,3,2.4],[1,1,2.2]]],256,false,true)],256,false,true)
422
+ assert_equal("0106000020000100000200000001030000400200000004000000CDCCCCCCCCCC28406666666666A646C0333333333333F33F3333333333B34640CDCCCCCCCCCC4440333333333333F33F6DE7FBA9F1D211403D2CD49AE61DF13F333333333333F33FCDCCCCCCCCCC28406666666666A646C0333333333333F33F0400000033333333333303403333333333331540333333333333F33F9A999999999915408A8EE4F21FD2F63F333333333333F33FEC51B81E85EB2C40F6285C8FC2F5F03F333333333333F33F33333333333303403333333333331540333333333333F33F0103000040020000000500000000000000000000000000000000000000333333333333F33F00000000000010400000000000000000333333333333F33F00000000000010400000000000001040666666666666024000000000000000000000000000001040333333333333F33F00000000000000000000000000000000333333333333F33F05000000000000000000F03F000000000000F03F9A999999999901400000000000000840000000000000F03F6666666666660A40000000000000084000000000000008409A9999999999F13F000000000000F03F00000000000008403333333333330340000000000000F03F000000000000F03F9A99999999990140",multi_polygon.as_hex_ewkb)
297
423
  end
424
+
298
425
  def test_multi_polygon_text
299
- multi_polygon = MultiPolygon.from_polygons([Polygon.from_raw_point_sequences([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],256),Polygon.from_raw_point_sequences([[[0,0],[4,0],[4,4],[0,4],[0,0]],[[1,1],[3,1],[3,3],[1,3],[1,1]]],256)],256)
300
- assert_equal("SRID=256;MULTIPOLYGON(((12.4 -45.3,45.4 41.6,4.456 1.0698,12.4 -45.3),(2.4 5.3,5.4 1.4263,14.46 1.06,2.4 5.3)),((0 0,4 0,4 4,0 4,0 0),(1 1,3 1,3 3,1 3,1 1)))",multi_polygon.as_text)
426
+ multi_polygon = MultiPolygon.from_polygons([Polygon.from_coordinates([[[12.4,-45.3],[45.4,41.6],[4.456,1.0698],[12.4,-45.3]],[[2.4,5.3],[5.4,1.4263],[14.46,1.06],[2.4,5.3]]],256),Polygon.from_coordinates([[[0,0],[4,0],[4,4],[0,4],[0,0]],[[1,1],[3,1],[3,3],[1,3],[1,1]]],256)],256)
427
+ assert_equal("SRID=256;MULTIPOLYGON(((12.4 -45.3,45.4 41.6,4.456 1.0698,12.4 -45.3),(2.4 5.3,5.4 1.4263,14.46 1.06,2.4 5.3)),((0 0,4 0,4 4,0 4,0 0),(1 1,3 1,3 3,1 3,1 1)))",multi_polygon.as_ewkt)
428
+
429
+ multi_polygon = MultiPolygon.from_polygons([Polygon.from_coordinates([[[12.4,-45.3,2],[45.4,41.6,3],[4.456,1.0698,4],[12.4,-45.3,2]],[[2.4,5.3,1],[5.4,1.4263,3.44],[14.46,1.06,4.5],[2.4,5.3,1]]],DEFAULT_SRID,true),Polygon.from_coordinates([[[0,0,5.6],[4,0,5.4],[4,4,1],[0,4,23],[0,0,5.6]],[[1,1,2.3],[3,1,4],[3,3,5],[1,3,6],[1,1,2.3]]],DEFAULT_SRID,true)],DEFAULT_SRID,true)
430
+ assert_equal("MULTIPOLYGON(((12.4 -45.3 2,45.4 41.6 3,4.456 1.0698 4,12.4 -45.3 2),(2.4 5.3 1,5.4 1.4263 3.44,14.46 1.06 4.5,2.4 5.3 1)),((0 0 5.6,4 0 5.4,4 4 1,0 4 23,0 0 5.6),(1 1 2.3,3 1 4,3 3 5,1 3 6,1 1 2.3)))",multi_polygon.as_ewkt)
431
+
301
432
  end
302
433
 
303
434
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: GeoRuby
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.4
7
- date: 2006-04-23 00:00:00 +05:00
6
+ version: 0.1.1
7
+ date: 2006-05-01 00:00:00 +05:00
8
8
  summary: Ruby data holder for OGC Simple Features
9
9
  require_paths:
10
10
  - lib