rgeo-shapefile 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +9 -0
  3. data/lib/rgeo/shapefile/version.rb +1 -1
  4. metadata +5 -41
  5. data/test/basic_test.rb +0 -8
  6. data/test/shapelib_cases_test.rb +0 -472
  7. data/test/shapelib_testcases/readme.txt +0 -11
  8. data/test/shapelib_testcases/test.dbf +0 -0
  9. data/test/shapelib_testcases/test.shp +0 -0
  10. data/test/shapelib_testcases/test.shx +0 -0
  11. data/test/shapelib_testcases/test0.shp +0 -0
  12. data/test/shapelib_testcases/test0.shx +0 -0
  13. data/test/shapelib_testcases/test1.shp +0 -0
  14. data/test/shapelib_testcases/test1.shx +0 -0
  15. data/test/shapelib_testcases/test10.shp +0 -0
  16. data/test/shapelib_testcases/test10.shx +0 -0
  17. data/test/shapelib_testcases/test11.shp +0 -0
  18. data/test/shapelib_testcases/test11.shx +0 -0
  19. data/test/shapelib_testcases/test12.shp +0 -0
  20. data/test/shapelib_testcases/test12.shx +0 -0
  21. data/test/shapelib_testcases/test13.shp +0 -0
  22. data/test/shapelib_testcases/test13.shx +0 -0
  23. data/test/shapelib_testcases/test2.shp +0 -0
  24. data/test/shapelib_testcases/test2.shx +0 -0
  25. data/test/shapelib_testcases/test3.shp +0 -0
  26. data/test/shapelib_testcases/test3.shx +0 -0
  27. data/test/shapelib_testcases/test4.shp +0 -0
  28. data/test/shapelib_testcases/test4.shx +0 -0
  29. data/test/shapelib_testcases/test5.shp +0 -0
  30. data/test/shapelib_testcases/test5.shx +0 -0
  31. data/test/shapelib_testcases/test6.shp +0 -0
  32. data/test/shapelib_testcases/test6.shx +0 -0
  33. data/test/shapelib_testcases/test7.shp +0 -0
  34. data/test/shapelib_testcases/test7.shx +0 -0
  35. data/test/shapelib_testcases/test8.shp +0 -0
  36. data/test/shapelib_testcases/test8.shx +0 -0
  37. data/test/shapelib_testcases/test9.shp +0 -0
  38. data/test/shapelib_testcases/test9.shx +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b5a5aafda1242e8363bb7fa480767f84af18ed6f
4
- data.tar.gz: 5e2a04bf415526a1614b01a3484f892b350ff72b
3
+ metadata.gz: bb0962585cf3d5624a5c53e9d869775beede18b3
4
+ data.tar.gz: 218d5b330c5d6dfdadb62792f3994a45753c271b
5
5
  SHA512:
6
- metadata.gz: 88cd189943f7d41623ac032b652dde5b5c228def9673887d8cba97ee005a418f8c3c85546a6e0a6cb18649fd183f097477fe7eba6616d036c25e0f56e2476f04
7
- data.tar.gz: 99d24dfa29fb82cfb0ea8672c240c0ab47c01a649a3bee5217e20fec28e2dcc4c4028e889a22c8b24fec60376a56f5652061b611a04e8c39d224b0937f576c94
6
+ metadata.gz: 213ca8c1174c4d3e5113794b57b53469df2fe26728f62e6103627a31a82e190b68cd0cabe312e7793c00f8a69dd06097ae9f8d78c8062580bef8c5575967441b
7
+ data.tar.gz: b5e0078ef7480c7d9dd3b65f0ab3d3f8431aa54d51cb9214b99270fb102c6c12bdaa0c1002b1bcbdce62969acbe8520c6c8c445b4e8ada5e5fa394a89fb35b58
data/History.md CHANGED
@@ -1,3 +1,12 @@
1
+ ### 0.4.1 / 2015-2-8
2
+
3
+ * Fix homepage in gemspec
4
+ * Do not distribute test files in gem
5
+
6
+ ### 0.4.0 / 2015-2-5
7
+
8
+ * Require ruby 2.0
9
+
1
10
  ### 0.3.0 / 2014-07-01
2
11
 
3
12
  * Require ruby 1.9.3+
@@ -1,5 +1,5 @@
1
1
  module RGeo
2
2
  module Shapefile
3
- VERSION = "0.4.0".freeze
3
+ VERSION = "0.4.1".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rgeo-shapefile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Azuma
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-02-05 00:00:00.000000000 Z
12
+ date: 2016-02-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rgeo
@@ -98,41 +98,7 @@ files:
98
98
  - lib/rgeo/shapefile.rb
99
99
  - lib/rgeo/shapefile/reader.rb
100
100
  - lib/rgeo/shapefile/version.rb
101
- - test/basic_test.rb
102
- - test/shapelib_cases_test.rb
103
- - test/shapelib_testcases/readme.txt
104
- - test/shapelib_testcases/test.dbf
105
- - test/shapelib_testcases/test.shp
106
- - test/shapelib_testcases/test.shx
107
- - test/shapelib_testcases/test0.shp
108
- - test/shapelib_testcases/test0.shx
109
- - test/shapelib_testcases/test1.shp
110
- - test/shapelib_testcases/test1.shx
111
- - test/shapelib_testcases/test10.shp
112
- - test/shapelib_testcases/test10.shx
113
- - test/shapelib_testcases/test11.shp
114
- - test/shapelib_testcases/test11.shx
115
- - test/shapelib_testcases/test12.shp
116
- - test/shapelib_testcases/test12.shx
117
- - test/shapelib_testcases/test13.shp
118
- - test/shapelib_testcases/test13.shx
119
- - test/shapelib_testcases/test2.shp
120
- - test/shapelib_testcases/test2.shx
121
- - test/shapelib_testcases/test3.shp
122
- - test/shapelib_testcases/test3.shx
123
- - test/shapelib_testcases/test4.shp
124
- - test/shapelib_testcases/test4.shx
125
- - test/shapelib_testcases/test5.shp
126
- - test/shapelib_testcases/test5.shx
127
- - test/shapelib_testcases/test6.shp
128
- - test/shapelib_testcases/test6.shx
129
- - test/shapelib_testcases/test7.shp
130
- - test/shapelib_testcases/test7.shx
131
- - test/shapelib_testcases/test8.shp
132
- - test/shapelib_testcases/test8.shx
133
- - test/shapelib_testcases/test9.shp
134
- - test/shapelib_testcases/test9.shx
135
- homepage: http://github.com/rgeo/rgeo-geojson
101
+ homepage: http://github.com/rgeo/rgeo-shapefile
136
102
  licenses:
137
103
  - BSD
138
104
  metadata: {}
@@ -152,11 +118,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
118
  version: '0'
153
119
  requirements: []
154
120
  rubyforge_project:
155
- rubygems_version: 2.5.1
121
+ rubygems_version: 2.5.2
156
122
  signing_key:
157
123
  specification_version: 4
158
124
  summary: An RGeo module for reading ESRI shapefiles.
159
- test_files:
160
- - test/basic_test.rb
161
- - test/shapelib_cases_test.rb
125
+ test_files: []
162
126
  has_rdoc:
data/test/basic_test.rb DELETED
@@ -1,8 +0,0 @@
1
- require "minitest/autorun"
2
- require "rgeo/shapefile"
3
-
4
- class BasicTest < Minitest::Test
5
- def test_has_version
6
- assert RGeo::Shapefile::VERSION.is_a?(String)
7
- end
8
- end
@@ -1,472 +0,0 @@
1
- require "minitest/autorun"
2
- require "rgeo/shapefile"
3
-
4
- class ShapelibCasesTest < Minitest::Test
5
- def test_open_with_block_returns_value_of_block
6
- result = _open_shapefile("test") do |file_|
7
- file_.num_records
8
- end
9
- assert_equal(3, result)
10
- end
11
-
12
- def test_rewind
13
- _open_shapefile("test") do |file_|
14
- assert_equal(0, file_.cur_index)
15
- rec_ = file_.next
16
- assert_equal(0, rec_.index)
17
- assert_equal(1, rec_.geometry[0].num_interior_rings)
18
- assert_equal(1, file_.cur_index)
19
- file_.rewind
20
- assert_equal(0, file_.cur_index)
21
- rec_ = file_.next
22
- assert_equal(0, rec_.index)
23
- assert_equal(1, rec_.geometry[0].num_interior_rings)
24
- end
25
- end
26
-
27
- def test_seek
28
- _open_shapefile("test") do |file_|
29
- assert_equal(0, file_.cur_index)
30
- assert_equal(false, file_.seek_index(4))
31
- assert_equal(0, file_.cur_index)
32
- file_.seek_index(3)
33
- assert_equal(3, file_.cur_index)
34
- assert_nil(file_.next)
35
- file_.seek_index(2)
36
- assert_equal(2, file_.cur_index)
37
- rec_ = file_.next
38
- assert_equal(2, rec_.index)
39
- assert_equal(0, rec_.geometry[0].num_interior_rings)
40
- assert_equal("", rec_["Descriptio"])
41
- file_.seek_index(0)
42
- assert_equal(0, file_.cur_index)
43
- rec_ = file_.next
44
- assert_equal(0, rec_.index)
45
- assert_equal(1, rec_.geometry[0].num_interior_rings)
46
- end
47
- end
48
-
49
- def test_attributes
50
- _open_shapefile("test") do |file_|
51
- rec_ = file_.next
52
- assert_equal("Square with triangle missing", rec_["Descriptio"])
53
- assert_equal("Square with triangle missing", rec_.attributes["Descriptio"])
54
- assert_equal(1, rec_["TestInt"])
55
- assert_equal(2.5, rec_["TestDouble"])
56
- assert_nil(rec_["NotAKey"])
57
- rec_ = file_.next
58
- assert_equal("Smaller triangle", rec_["Descriptio"])
59
- assert_equal(100, rec_["TestInt"])
60
- assert_equal(1000.25, rec_["TestDouble"])
61
- rec_ = file_.next
62
- assert_equal("", rec_["Descriptio"])
63
- assert_equal(0, rec_["TestInt"])
64
- assert_equal(0, rec_["TestDouble"])
65
- end
66
- end
67
-
68
- def test_test0
69
- _open_shapefile("test0") do |file_|
70
- assert_equal(0, file_.shape_type_code)
71
- assert_equal(2, file_.num_records)
72
- rec_ = file_.next
73
- assert_equal(0, rec_.index)
74
- assert_nil(rec_.geometry)
75
- rec_ = file_.next
76
- assert_equal(1, rec_.index)
77
- assert_nil(rec_.geometry)
78
- assert_nil(file_.next)
79
- end
80
- end
81
-
82
- def _test_point_shapefile(filename_, has_z_, has_m_)
83
- _open_shapefile(filename_) do |file_|
84
- assert_equal(has_z_ ? 11 : has_m_ ? 21 : 1, file_.shape_type_code)
85
- assert_equal(2, file_.num_records)
86
- assert_equal(has_z_, file_.factory.property(:has_z_coordinate))
87
- assert_equal(has_m_, file_.factory.property(:has_m_coordinate))
88
- rec_ = file_.next
89
- assert_equal(0, rec_.index)
90
- assert_equal(RGeo::Feature::Point, rec_.geometry.geometry_type)
91
- assert_equal(1, rec_.geometry.x)
92
- assert_equal(2, rec_.geometry.y)
93
- assert_equal(3, rec_.geometry.z) if has_z_
94
- assert_equal(4, rec_.geometry.m) if has_m_
95
- rec_ = file_.next
96
- assert_equal(1, rec_.index)
97
- assert_equal(RGeo::Feature::Point, rec_.geometry.geometry_type)
98
- assert_equal(10, rec_.geometry.x)
99
- assert_equal(20, rec_.geometry.y)
100
- assert_equal(30, rec_.geometry.z) if has_z_
101
- assert_equal(40, rec_.geometry.m) if has_m_
102
- assert_nil(file_.next)
103
- end
104
- end
105
-
106
- def test_test1
107
- _test_point_shapefile("test1", false, false)
108
- end
109
-
110
- def test_test2
111
- _test_point_shapefile("test2", true, true)
112
- end
113
-
114
- def test_test3
115
- _test_point_shapefile("test3", false, true)
116
- end
117
-
118
- def _test_multipoint_shapefile(filename_, has_z_, has_m_)
119
- _open_shapefile(filename_) do |file_|
120
- assert_equal(has_z_ ? 18 : has_m_ ? 28 : 8, file_.shape_type_code)
121
- assert_equal(3, file_.num_records)
122
- assert_equal(has_z_, file_.factory.property(:has_z_coordinate))
123
- assert_equal(has_m_, file_.factory.property(:has_m_coordinate))
124
- rec_ = file_.next
125
- assert_equal(RGeo::Feature::MultiPoint, rec_.geometry.geometry_type)
126
- assert_equal(4, rec_.geometry.num_geometries)
127
- assert_equal(1.15, rec_.geometry[0].x)
128
- assert_equal(2.25, rec_.geometry[0].y)
129
- assert_equal(3.35, rec_.geometry[0].z) if has_z_
130
- assert_equal(4.45, rec_.geometry[0].m) if has_m_
131
- assert_equal(4.15, rec_.geometry[3].x)
132
- assert_equal(5.25, rec_.geometry[3].y)
133
- assert_equal(6.35, rec_.geometry[3].z) if has_z_
134
- assert_equal(7.45, rec_.geometry[3].m) if has_m_
135
- rec_ = file_.next
136
- assert_equal(RGeo::Feature::MultiPoint, rec_.geometry.geometry_type)
137
- assert_equal(4, rec_.geometry.num_geometries)
138
- rec_ = file_.next
139
- assert_equal(RGeo::Feature::MultiPoint, rec_.geometry.geometry_type)
140
- assert_equal(4, rec_.geometry.num_geometries)
141
- assert_equal(21.15, rec_.geometry[0].x)
142
- assert_equal(22.25, rec_.geometry[0].y)
143
- assert_equal(23.35, rec_.geometry[0].z) if has_z_
144
- assert_equal(24.45, rec_.geometry[0].m) if has_m_
145
- assert_equal(24.15, rec_.geometry[3].x)
146
- assert_equal(25.25, rec_.geometry[3].y)
147
- assert_equal(26.35, rec_.geometry[3].z) if has_z_
148
- assert_equal(27.45, rec_.geometry[3].m) if has_m_
149
- assert_nil(file_.next)
150
- end
151
- end
152
-
153
- def test_test4
154
- _test_multipoint_shapefile("test4", false, false)
155
- end
156
-
157
- def test_test5
158
- _test_multipoint_shapefile("test5", true, true)
159
- end
160
-
161
- def test_test6
162
- _test_multipoint_shapefile("test6", false, true)
163
- end
164
-
165
- def _test_polyline_shapefile(filename_, has_z_, has_m_)
166
- _open_shapefile(filename_) do |file_|
167
- assert_equal(has_z_ ? 13 : has_m_ ? 23 : 3, file_.shape_type_code)
168
- assert_equal(4, file_.num_records)
169
- assert_equal(has_z_, file_.factory.property(:has_z_coordinate))
170
- assert_equal(has_m_, file_.factory.property(:has_m_coordinate))
171
- rec_ = file_.next
172
- assert_equal(RGeo::Feature::MultiLineString, rec_.geometry.geometry_type)
173
- assert_equal(1, rec_.geometry.num_geometries)
174
- assert_equal(5, rec_.geometry[0].num_points)
175
- assert_equal(1, rec_.geometry[0].point_n(0).x)
176
- assert_equal(1, rec_.geometry[0].point_n(0).y)
177
- assert_equal(3.35, rec_.geometry[0].point_n(0).z) if has_z_
178
- assert_equal(4.45, rec_.geometry[0].point_n(0).m) if has_m_
179
- assert_equal(2, rec_.geometry[0].point_n(1).x)
180
- assert_equal(1, rec_.geometry[0].point_n(1).y)
181
- assert_equal(4.35, rec_.geometry[0].point_n(1).z) if has_z_
182
- assert_equal(5.45, rec_.geometry[0].point_n(1).m) if has_m_
183
- assert_equal(2, rec_.geometry[0].point_n(2).x)
184
- assert_equal(2, rec_.geometry[0].point_n(2).y)
185
- assert_equal(5.35, rec_.geometry[0].point_n(2).z) if has_z_
186
- assert_equal(6.45, rec_.geometry[0].point_n(2).m) if has_m_
187
- assert_equal(1, rec_.geometry[0].point_n(4).x)
188
- assert_equal(1, rec_.geometry[0].point_n(4).y)
189
- assert_equal(7.35, rec_.geometry[0].point_n(4).z) if has_z_
190
- assert_equal(8.45, rec_.geometry[0].point_n(4).m) if has_m_
191
- rec_ = file_.next
192
- assert_equal(RGeo::Feature::MultiLineString, rec_.geometry.geometry_type)
193
- assert_equal(1, rec_.geometry.num_geometries)
194
- rec_ = file_.next
195
- assert_equal(RGeo::Feature::MultiLineString, rec_.geometry.geometry_type)
196
- assert_equal(1, rec_.geometry.num_geometries)
197
- assert_equal(5, rec_.geometry[0].num_points)
198
- assert_equal(1, rec_.geometry[0].point_n(0).x)
199
- assert_equal(7, rec_.geometry[0].point_n(0).y)
200
- assert_equal(23.35, rec_.geometry[0].point_n(0).z) if has_z_
201
- assert_equal(24.45, rec_.geometry[0].point_n(0).m) if has_m_
202
- assert_equal(2, rec_.geometry[0].point_n(1).x)
203
- assert_equal(7, rec_.geometry[0].point_n(1).y)
204
- assert_equal(24.35, rec_.geometry[0].point_n(1).z) if has_z_
205
- assert_equal(25.45, rec_.geometry[0].point_n(1).m) if has_m_
206
- assert_equal(2, rec_.geometry[0].point_n(2).x)
207
- assert_equal(8, rec_.geometry[0].point_n(2).y)
208
- assert_equal(25.35, rec_.geometry[0].point_n(2).z) if has_z_
209
- assert_equal(26.45, rec_.geometry[0].point_n(2).m) if has_m_
210
- assert_equal(1, rec_.geometry[0].point_n(4).x)
211
- assert_equal(7, rec_.geometry[0].point_n(4).y)
212
- assert_equal(27.35, rec_.geometry[0].point_n(4).z) if has_z_
213
- assert_equal(28.45, rec_.geometry[0].point_n(4).m) if has_m_
214
- rec_ = file_.next
215
- assert_equal(RGeo::Feature::MultiLineString, rec_.geometry.geometry_type)
216
- assert_equal(3, rec_.geometry.num_geometries)
217
- assert_equal(5, rec_.geometry[0].num_points)
218
- assert_equal(0, rec_.geometry[0].point_n(0).x)
219
- assert_equal(0, rec_.geometry[0].point_n(0).y)
220
- assert_equal(0, rec_.geometry[0].point_n(0).z) if has_z_
221
- assert_equal(0, rec_.geometry[0].point_n(0).m) if has_m_
222
- assert_equal(0, rec_.geometry[0].point_n(1).x)
223
- assert_equal(100, rec_.geometry[0].point_n(1).y)
224
- assert_equal(1, rec_.geometry[0].point_n(1).z) if has_z_
225
- assert_equal(2, rec_.geometry[0].point_n(1).m) if has_m_
226
- assert_equal(0, rec_.geometry[0].point_n(4).x)
227
- assert_equal(0, rec_.geometry[0].point_n(4).y)
228
- assert_equal(4, rec_.geometry[0].point_n(4).z) if has_z_
229
- assert_equal(8, rec_.geometry[0].point_n(4).m) if has_m_
230
- assert_equal(5, rec_.geometry[1].num_points)
231
- assert_equal(10, rec_.geometry[1].point_n(0).x)
232
- assert_equal(20, rec_.geometry[1].point_n(0).y)
233
- assert_equal(5, rec_.geometry[1].point_n(0).z) if has_z_
234
- assert_equal(10, rec_.geometry[1].point_n(0).m) if has_m_
235
- assert_equal(30, rec_.geometry[1].point_n(1).x)
236
- assert_equal(20, rec_.geometry[1].point_n(1).y)
237
- assert_equal(6, rec_.geometry[1].point_n(1).z) if has_z_
238
- assert_equal(12, rec_.geometry[1].point_n(1).m) if has_m_
239
- assert_equal(30, rec_.geometry[1].point_n(2).x)
240
- assert_equal(40, rec_.geometry[1].point_n(2).y)
241
- assert_equal(7, rec_.geometry[1].point_n(2).z) if has_z_
242
- assert_equal(14, rec_.geometry[1].point_n(2).m) if has_m_
243
- assert_equal(5, rec_.geometry[2].num_points)
244
- assert_equal(60, rec_.geometry[2].point_n(0).x)
245
- assert_equal(20, rec_.geometry[2].point_n(0).y)
246
- assert_equal(10, rec_.geometry[2].point_n(0).z) if has_z_
247
- assert_equal(20, rec_.geometry[2].point_n(0).m) if has_m_
248
- assert_equal(90, rec_.geometry[2].point_n(1).x)
249
- assert_equal(20, rec_.geometry[2].point_n(1).y)
250
- assert_equal(11, rec_.geometry[2].point_n(1).z) if has_z_
251
- assert_equal(22, rec_.geometry[2].point_n(1).m) if has_m_
252
- assert_equal(60, rec_.geometry[2].point_n(4).x)
253
- assert_equal(20, rec_.geometry[2].point_n(4).y)
254
- assert_equal(14, rec_.geometry[2].point_n(4).z) if has_z_
255
- assert_equal(28, rec_.geometry[2].point_n(4).m) if has_m_
256
- end
257
- end
258
-
259
- def test_test7
260
- _test_polyline_shapefile("test7", false, false)
261
- end
262
-
263
- def test_test8
264
- _test_polyline_shapefile("test8", true, true)
265
- end
266
-
267
- def test_test9
268
- _test_polyline_shapefile("test9", false, true)
269
- end
270
-
271
- def _test_polygon_shapefile(filename_, has_z_, has_m_)
272
- _open_shapefile(filename_) do |file_|
273
- assert_equal(has_z_ ? 15 : has_m_ ? 25 : 5, file_.shape_type_code)
274
- assert_equal(4, file_.num_records)
275
- assert_equal(has_z_, file_.factory.property(:has_z_coordinate))
276
- assert_equal(has_m_, file_.factory.property(:has_m_coordinate))
277
- rec_ = file_.next
278
- assert_equal(RGeo::Feature::MultiPolygon, rec_.geometry.geometry_type)
279
- assert_equal(1, rec_.geometry.num_geometries)
280
- assert_equal(0, rec_.geometry[0].num_interior_rings)
281
- assert_equal(5, rec_.geometry[0].exterior_ring.num_points)
282
- assert_equal(1, rec_.geometry[0].exterior_ring.point_n(0).x)
283
- assert_equal(1, rec_.geometry[0].exterior_ring.point_n(0).y)
284
- assert_equal(3.35, rec_.geometry[0].exterior_ring.point_n(0).z) if has_z_
285
- assert_equal(4.45, rec_.geometry[0].exterior_ring.point_n(0).m) if has_m_
286
- assert_equal(2, rec_.geometry[0].exterior_ring.point_n(1).x)
287
- assert_equal(1, rec_.geometry[0].exterior_ring.point_n(1).y)
288
- assert_equal(4.35, rec_.geometry[0].exterior_ring.point_n(1).z) if has_z_
289
- assert_equal(5.45, rec_.geometry[0].exterior_ring.point_n(1).m) if has_m_
290
- assert_equal(2, rec_.geometry[0].exterior_ring.point_n(2).x)
291
- assert_equal(2, rec_.geometry[0].exterior_ring.point_n(2).y)
292
- assert_equal(5.35, rec_.geometry[0].exterior_ring.point_n(2).z) if has_z_
293
- assert_equal(6.45, rec_.geometry[0].exterior_ring.point_n(2).m) if has_m_
294
- assert_equal(1, rec_.geometry[0].exterior_ring.point_n(4).x)
295
- assert_equal(1, rec_.geometry[0].exterior_ring.point_n(4).y)
296
- assert_equal(7.35, rec_.geometry[0].exterior_ring.point_n(4).z) if has_z_
297
- assert_equal(8.45, rec_.geometry[0].exterior_ring.point_n(4).m) if has_m_
298
- rec_ = file_.next
299
- assert_equal(RGeo::Feature::MultiPolygon, rec_.geometry.geometry_type)
300
- assert_equal(1, rec_.geometry.num_geometries)
301
- rec_ = file_.next
302
- assert_equal(RGeo::Feature::MultiPolygon, rec_.geometry.geometry_type)
303
- assert_equal(1, rec_.geometry.num_geometries)
304
- assert_equal(0, rec_.geometry[0].num_interior_rings)
305
- assert_equal(5, rec_.geometry[0].exterior_ring.num_points)
306
- assert_equal(1, rec_.geometry[0].exterior_ring.point_n(0).x)
307
- assert_equal(7, rec_.geometry[0].exterior_ring.point_n(0).y)
308
- assert_equal(23.35, rec_.geometry[0].exterior_ring.point_n(0).z) if has_z_
309
- assert_equal(24.45, rec_.geometry[0].exterior_ring.point_n(0).m) if has_m_
310
- assert_equal(2, rec_.geometry[0].exterior_ring.point_n(1).x)
311
- assert_equal(7, rec_.geometry[0].exterior_ring.point_n(1).y)
312
- assert_equal(24.35, rec_.geometry[0].exterior_ring.point_n(1).z) if has_z_
313
- assert_equal(25.45, rec_.geometry[0].exterior_ring.point_n(1).m) if has_m_
314
- assert_equal(2, rec_.geometry[0].exterior_ring.point_n(2).x)
315
- assert_equal(8, rec_.geometry[0].exterior_ring.point_n(2).y)
316
- assert_equal(25.35, rec_.geometry[0].exterior_ring.point_n(2).z) if has_z_
317
- assert_equal(26.45, rec_.geometry[0].exterior_ring.point_n(2).m) if has_m_
318
- assert_equal(1, rec_.geometry[0].exterior_ring.point_n(4).x)
319
- assert_equal(7, rec_.geometry[0].exterior_ring.point_n(4).y)
320
- assert_equal(27.35, rec_.geometry[0].exterior_ring.point_n(4).z) if has_z_
321
- assert_equal(28.45, rec_.geometry[0].exterior_ring.point_n(4).m) if has_m_
322
- rec_ = file_.next
323
- assert_equal(RGeo::Feature::MultiPolygon, rec_.geometry.geometry_type)
324
- assert_equal(1, rec_.geometry.num_geometries)
325
- assert_equal(2, rec_.geometry[0].num_interior_rings)
326
- assert_equal(5, rec_.geometry[0].exterior_ring.num_points)
327
- assert_equal(0, rec_.geometry[0].exterior_ring.point_n(0).x)
328
- assert_equal(0, rec_.geometry[0].exterior_ring.point_n(0).y)
329
- assert_equal(0, rec_.geometry[0].exterior_ring.point_n(0).z) if has_z_
330
- assert_equal(0, rec_.geometry[0].exterior_ring.point_n(0).m) if has_m_
331
- assert_equal(0, rec_.geometry[0].exterior_ring.point_n(1).x)
332
- assert_equal(100, rec_.geometry[0].exterior_ring.point_n(1).y)
333
- assert_equal(1, rec_.geometry[0].exterior_ring.point_n(1).z) if has_z_
334
- assert_equal(2, rec_.geometry[0].exterior_ring.point_n(1).m) if has_m_
335
- assert_equal(0, rec_.geometry[0].exterior_ring.point_n(4).x)
336
- assert_equal(0, rec_.geometry[0].exterior_ring.point_n(4).y)
337
- assert_equal(4, rec_.geometry[0].exterior_ring.point_n(4).z) if has_z_
338
- assert_equal(8, rec_.geometry[0].exterior_ring.point_n(4).m) if has_m_
339
- assert_equal(5, rec_.geometry[0].interior_ring_n(0).num_points)
340
- assert_equal(10, rec_.geometry[0].interior_ring_n(0).point_n(0).x)
341
- assert_equal(20, rec_.geometry[0].interior_ring_n(0).point_n(0).y)
342
- assert_equal(5, rec_.geometry[0].interior_ring_n(0).point_n(0).z) if has_z_
343
- assert_equal(10, rec_.geometry[0].interior_ring_n(0).point_n(0).m) if has_m_
344
- assert_equal(30, rec_.geometry[0].interior_ring_n(0).point_n(1).x)
345
- assert_equal(20, rec_.geometry[0].interior_ring_n(0).point_n(1).y)
346
- assert_equal(6, rec_.geometry[0].interior_ring_n(0).point_n(1).z) if has_z_
347
- assert_equal(12, rec_.geometry[0].interior_ring_n(0).point_n(1).m) if has_m_
348
- assert_equal(30, rec_.geometry[0].interior_ring_n(0).point_n(2).x)
349
- assert_equal(40, rec_.geometry[0].interior_ring_n(0).point_n(2).y)
350
- assert_equal(7, rec_.geometry[0].interior_ring_n(0).point_n(2).z) if has_z_
351
- assert_equal(14, rec_.geometry[0].interior_ring_n(0).point_n(2).m) if has_m_
352
- assert_equal(5, rec_.geometry[0].interior_ring_n(1).num_points)
353
- assert_equal(60, rec_.geometry[0].interior_ring_n(1).point_n(0).x)
354
- assert_equal(20, rec_.geometry[0].interior_ring_n(1).point_n(0).y)
355
- assert_equal(10, rec_.geometry[0].interior_ring_n(1).point_n(0).z) if has_z_
356
- assert_equal(20, rec_.geometry[0].interior_ring_n(1).point_n(0).m) if has_m_
357
- assert_equal(90, rec_.geometry[0].interior_ring_n(1).point_n(1).x)
358
- assert_equal(20, rec_.geometry[0].interior_ring_n(1).point_n(1).y)
359
- assert_equal(11, rec_.geometry[0].interior_ring_n(1).point_n(1).z) if has_z_
360
- assert_equal(22, rec_.geometry[0].interior_ring_n(1).point_n(1).m) if has_m_
361
- assert_equal(60, rec_.geometry[0].interior_ring_n(1).point_n(4).x)
362
- assert_equal(20, rec_.geometry[0].interior_ring_n(1).point_n(4).y)
363
- assert_equal(14, rec_.geometry[0].interior_ring_n(1).point_n(4).z) if has_z_
364
- assert_equal(28, rec_.geometry[0].interior_ring_n(1).point_n(4).m) if has_m_
365
- end
366
- end
367
-
368
- def test_test10
369
- _test_polygon_shapefile("test10", false, false)
370
- end
371
-
372
- def test_test11
373
- _test_polygon_shapefile("test11", true, true)
374
- end
375
-
376
- def test_test12
377
- _test_polygon_shapefile("test12", false, true)
378
- end
379
-
380
- def test_test13
381
- _open_shapefile("test13") do |file_|
382
- assert_equal(31, file_.shape_type_code)
383
- assert_equal(4, file_.num_records)
384
- assert_equal(true, file_.factory.property(:has_z_coordinate))
385
- # I believe shapefile's test13 incorrectly includes bounding
386
- # box data for m, since there is no actual m data. So I
387
- # disabled this test:
388
- # assert_equal(false, file_.factory.property(:has_m_coordinate))
389
- rec_ = file_.next
390
- assert_equal(RGeo::Feature::GeometryCollection, rec_.geometry.geometry_type)
391
- assert_equal(1, rec_.geometry.num_geometries)
392
- assert_equal(0, rec_.geometry[0].num_interior_rings)
393
- assert_equal(5, rec_.geometry[0].exterior_ring.num_points)
394
- assert_equal(1, rec_.geometry[0].exterior_ring.point_n(0).x)
395
- assert_equal(1, rec_.geometry[0].exterior_ring.point_n(0).y)
396
- assert_equal(3.35, rec_.geometry[0].exterior_ring.point_n(0).z)
397
- assert_equal(2, rec_.geometry[0].exterior_ring.point_n(1).x)
398
- assert_equal(1, rec_.geometry[0].exterior_ring.point_n(1).y)
399
- assert_equal(4.35, rec_.geometry[0].exterior_ring.point_n(1).z)
400
- assert_equal(2, rec_.geometry[0].exterior_ring.point_n(2).x)
401
- assert_equal(2, rec_.geometry[0].exterior_ring.point_n(2).y)
402
- assert_equal(5.35, rec_.geometry[0].exterior_ring.point_n(2).z)
403
- assert_equal(1, rec_.geometry[0].exterior_ring.point_n(4).x)
404
- assert_equal(1, rec_.geometry[0].exterior_ring.point_n(4).y)
405
- assert_equal(7.35, rec_.geometry[0].exterior_ring.point_n(4).z)
406
- rec_ = file_.next
407
- assert_equal(RGeo::Feature::GeometryCollection, rec_.geometry.geometry_type)
408
- assert_equal(1, rec_.geometry.num_geometries)
409
- rec_ = file_.next
410
- assert_equal(RGeo::Feature::GeometryCollection, rec_.geometry.geometry_type)
411
- assert_equal(1, rec_.geometry.num_geometries)
412
- assert_equal(0, rec_.geometry[0].num_interior_rings)
413
- assert_equal(5, rec_.geometry[0].exterior_ring.num_points)
414
- assert_equal(1, rec_.geometry[0].exterior_ring.point_n(0).x)
415
- assert_equal(7, rec_.geometry[0].exterior_ring.point_n(0).y)
416
- assert_equal(23.35, rec_.geometry[0].exterior_ring.point_n(0).z)
417
- assert_equal(2, rec_.geometry[0].exterior_ring.point_n(1).x)
418
- assert_equal(7, rec_.geometry[0].exterior_ring.point_n(1).y)
419
- assert_equal(24.35, rec_.geometry[0].exterior_ring.point_n(1).z)
420
- assert_equal(2, rec_.geometry[0].exterior_ring.point_n(2).x)
421
- assert_equal(8, rec_.geometry[0].exterior_ring.point_n(2).y)
422
- assert_equal(25.35, rec_.geometry[0].exterior_ring.point_n(2).z)
423
- assert_equal(1, rec_.geometry[0].exterior_ring.point_n(4).x)
424
- assert_equal(7, rec_.geometry[0].exterior_ring.point_n(4).y)
425
- assert_equal(27.35, rec_.geometry[0].exterior_ring.point_n(4).z)
426
- rec_ = file_.next
427
- assert_equal(RGeo::Feature::GeometryCollection, rec_.geometry.geometry_type)
428
- assert_equal(1, rec_.geometry.num_geometries)
429
- assert_equal(2, rec_.geometry[0].num_interior_rings)
430
- assert_equal(5, rec_.geometry[0].exterior_ring.num_points)
431
- assert_equal(0, rec_.geometry[0].exterior_ring.point_n(0).x)
432
- assert_equal(0, rec_.geometry[0].exterior_ring.point_n(0).y)
433
- assert_equal(0, rec_.geometry[0].exterior_ring.point_n(0).z)
434
- assert_equal(0, rec_.geometry[0].exterior_ring.point_n(1).x)
435
- assert_equal(100, rec_.geometry[0].exterior_ring.point_n(1).y)
436
- assert_equal(1, rec_.geometry[0].exterior_ring.point_n(1).z)
437
- assert_equal(0, rec_.geometry[0].exterior_ring.point_n(4).x)
438
- assert_equal(0, rec_.geometry[0].exterior_ring.point_n(4).y)
439
- assert_equal(4, rec_.geometry[0].exterior_ring.point_n(4).z)
440
- assert_equal(5, rec_.geometry[0].interior_ring_n(0).num_points)
441
- assert_equal(10, rec_.geometry[0].interior_ring_n(0).point_n(0).x)
442
- assert_equal(20, rec_.geometry[0].interior_ring_n(0).point_n(0).y)
443
- assert_equal(5, rec_.geometry[0].interior_ring_n(0).point_n(0).z)
444
- assert_equal(30, rec_.geometry[0].interior_ring_n(0).point_n(1).x)
445
- assert_equal(20, rec_.geometry[0].interior_ring_n(0).point_n(1).y)
446
- assert_equal(6, rec_.geometry[0].interior_ring_n(0).point_n(1).z)
447
- assert_equal(30, rec_.geometry[0].interior_ring_n(0).point_n(2).x)
448
- assert_equal(40, rec_.geometry[0].interior_ring_n(0).point_n(2).y)
449
- assert_equal(7, rec_.geometry[0].interior_ring_n(0).point_n(2).z)
450
- assert_equal(5, rec_.geometry[0].interior_ring_n(1).num_points)
451
- assert_equal(60, rec_.geometry[0].interior_ring_n(1).point_n(0).x)
452
- assert_equal(20, rec_.geometry[0].interior_ring_n(1).point_n(0).y)
453
- assert_equal(10, rec_.geometry[0].interior_ring_n(1).point_n(0).z)
454
- assert_equal(90, rec_.geometry[0].interior_ring_n(1).point_n(1).x)
455
- assert_equal(20, rec_.geometry[0].interior_ring_n(1).point_n(1).y)
456
- assert_equal(11, rec_.geometry[0].interior_ring_n(1).point_n(1).z)
457
- assert_equal(60, rec_.geometry[0].interior_ring_n(1).point_n(4).x)
458
- assert_equal(20, rec_.geometry[0].interior_ring_n(1).point_n(4).y)
459
- assert_equal(14, rec_.geometry[0].interior_ring_n(1).point_n(4).z)
460
- end
461
- end
462
-
463
- private
464
-
465
- def _open_shapefile(name_, &block_)
466
- RGeo::Shapefile::Reader.open(
467
- File.expand_path("shapelib_testcases/#{name_}",
468
- File.dirname(__FILE__)),
469
- &block_
470
- )
471
- end
472
- end
@@ -1,11 +0,0 @@
1
- The shapefiles in this directory are a test suite used by shapelib.
2
- They don't cover every case, but seemed a good starting point.
3
- Shapelib can be found at http://shapelib.maptools.org/
4
-
5
- The numbered test files are generated by the shptest tool. The
6
- non-numbered case (including a dbf file) is generated by the
7
- makeshape.sh script. Both were run from shapelib release 1.3.0b2.
8
-
9
- Since we're embedding the test cases themselves here in this
10
- directory, we note that they are Copyright 1999 Frank Warmerdam,
11
- and are distributed under an MIT style license.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file