rgeo-shapefile 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.rdoc +7 -0
- data/README.rdoc +3 -5
- data/Version +1 -1
- data/lib/rgeo-shapefile.rb +36 -0
- data/lib/rgeo/shapefile.rb +13 -13
- data/lib/rgeo/shapefile/reader.rb +164 -163
- data/lib/rgeo/shapefile/version.rb +12 -12
- data/test/shapelib_testcases/readme.txt +1 -1
- data/test/tc_basic.rb +13 -13
- data/test/tc_shapelib_tests.rb +56 -55
- metadata +40 -43
@@ -1,15 +1,15 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Version of rgeo-shapefile
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
# Copyright 2010 Daniel Azuma
|
7
|
-
#
|
6
|
+
# Copyright 2010-2012 Daniel Azuma
|
7
|
+
#
|
8
8
|
# All rights reserved.
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# Redistribution and use in source and binary forms, with or without
|
11
11
|
# modification, are permitted provided that the following conditions are met:
|
12
|
-
#
|
12
|
+
#
|
13
13
|
# * Redistributions of source code must retain the above copyright notice,
|
14
14
|
# this list of conditions and the following disclaimer.
|
15
15
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
@@ -18,7 +18,7 @@
|
|
18
18
|
# * Neither the name of the copyright holder, nor the names of any other
|
19
19
|
# contributors to this software, may be used to endorse or promote products
|
20
20
|
# derived from this software without specific prior written permission.
|
21
|
-
#
|
21
|
+
#
|
22
22
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
23
23
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
24
24
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
@@ -41,16 +41,16 @@ end
|
|
41
41
|
|
42
42
|
|
43
43
|
module RGeo
|
44
|
-
|
44
|
+
|
45
45
|
module Shapefile
|
46
|
-
|
46
|
+
|
47
47
|
# Current version of RGeo::Shapefile as a frozen string
|
48
48
|
VERSION_STRING = ::File.read(::File.dirname(__FILE__)+'/../../../Version').strip.freeze
|
49
|
-
|
49
|
+
|
50
50
|
# Current version of RGeo::Shapefile as a Versionomy object, if the
|
51
51
|
# Versionomy gem is available; otherwise equal to VERSION_STRING.
|
52
52
|
VERSION = defined?(::Versionomy) ? ::Versionomy.parse(VERSION_STRING) : VERSION_STRING
|
53
|
-
|
53
|
+
|
54
54
|
end
|
55
|
-
|
55
|
+
|
56
56
|
end
|
@@ -8,4 +8,4 @@ makeshape.sh script. Both were run from shapelib release 1.3.0b2.
|
|
8
8
|
|
9
9
|
Since we're embedding the test cases themselves here in this
|
10
10
|
directory, we note that they are Copyright 1999 Frank Warmerdam,
|
11
|
-
and are
|
11
|
+
and are distributed under an MIT style license.
|
data/test/tc_basic.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Some shapefile reading test cases borrowed from shapelib
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
# Copyright 2010 Daniel Azuma
|
7
|
-
#
|
6
|
+
# Copyright 2010-2012 Daniel Azuma
|
7
|
+
#
|
8
8
|
# All rights reserved.
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# Redistribution and use in source and binary forms, with or without
|
11
11
|
# modification, are permitted provided that the following conditions are met:
|
12
|
-
#
|
12
|
+
#
|
13
13
|
# * Redistributions of source code must retain the above copyright notice,
|
14
14
|
# this list of conditions and the following disclaimer.
|
15
15
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
@@ -18,7 +18,7 @@
|
|
18
18
|
# * Neither the name of the copyright holder, nor the names of any other
|
19
19
|
# contributors to this software, may be used to endorse or promote products
|
20
20
|
# derived from this software without specific prior written permission.
|
21
|
-
#
|
21
|
+
#
|
22
22
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
23
23
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
24
24
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
@@ -41,17 +41,17 @@ require 'rgeo/shapefile'
|
|
41
41
|
module RGeo
|
42
42
|
module Shapefile
|
43
43
|
module Tests # :nodoc:
|
44
|
-
|
44
|
+
|
45
45
|
class TestBasic < ::Test::Unit::TestCase # :nodoc:
|
46
|
-
|
47
|
-
|
46
|
+
|
47
|
+
|
48
48
|
def test_has_version
|
49
49
|
assert_not_nil(::RGeo::Shapefile::VERSION)
|
50
50
|
end
|
51
|
-
|
52
|
-
|
51
|
+
|
52
|
+
|
53
53
|
end
|
54
|
-
|
54
|
+
|
55
55
|
end
|
56
56
|
end
|
57
57
|
end
|
data/test/tc_shapelib_tests.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Some shapefile reading test cases borrowed from shapelib
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# -----------------------------------------------------------------------------
|
6
|
-
# Copyright 2010 Daniel Azuma
|
7
|
-
#
|
6
|
+
# Copyright 2010-2012 Daniel Azuma
|
7
|
+
#
|
8
8
|
# All rights reserved.
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# Redistribution and use in source and binary forms, with or without
|
11
11
|
# modification, are permitted provided that the following conditions are met:
|
12
|
-
#
|
12
|
+
#
|
13
13
|
# * Redistributions of source code must retain the above copyright notice,
|
14
14
|
# this list of conditions and the following disclaimer.
|
15
15
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
@@ -18,7 +18,7 @@
|
|
18
18
|
# * Neither the name of the copyright holder, nor the names of any other
|
19
19
|
# contributors to this software, may be used to endorse or promote products
|
20
20
|
# derived from this software without specific prior written permission.
|
21
|
-
#
|
21
|
+
#
|
22
22
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
23
23
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
24
24
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
@@ -41,14 +41,14 @@ require 'rgeo/shapefile'
|
|
41
41
|
module RGeo
|
42
42
|
module Shapefile
|
43
43
|
module Tests # :nodoc:
|
44
|
-
|
44
|
+
|
45
45
|
class TestShapelibTests < ::Test::Unit::TestCase # :nodoc:
|
46
|
-
|
46
|
+
|
47
47
|
def _open_shapefile(name_, &block_)
|
48
48
|
RGeo::Shapefile::Reader.open(::File.expand_path("shapelib_testcases/#{name_}", ::File.dirname(__FILE__)), &block_)
|
49
49
|
end
|
50
|
-
|
51
|
-
|
50
|
+
|
51
|
+
|
52
52
|
def test_rewind
|
53
53
|
_open_shapefile('test') do |file_|
|
54
54
|
assert_equal(0, file_.cur_index)
|
@@ -63,8 +63,8 @@ module RGeo
|
|
63
63
|
assert_equal(1, rec_.geometry[0].num_interior_rings)
|
64
64
|
end
|
65
65
|
end
|
66
|
-
|
67
|
-
|
66
|
+
|
67
|
+
|
68
68
|
def test_seek
|
69
69
|
_open_shapefile('test') do |file_|
|
70
70
|
assert_equal(0, file_.cur_index)
|
@@ -86,12 +86,13 @@ module RGeo
|
|
86
86
|
assert_equal(1, rec_.geometry[0].num_interior_rings)
|
87
87
|
end
|
88
88
|
end
|
89
|
-
|
90
|
-
|
89
|
+
|
90
|
+
|
91
91
|
def test_attributes
|
92
92
|
_open_shapefile('test') do |file_|
|
93
93
|
rec_ = file_.next
|
94
94
|
assert_equal('Square with triangle missing', rec_['Descriptio'])
|
95
|
+
assert_equal('Square with triangle missing', rec_.attributes['Descriptio'])
|
95
96
|
assert_equal(1, rec_['TestInt'])
|
96
97
|
assert_equal(2.5, rec_['TestDouble'])
|
97
98
|
assert_nil(rec_['NotAKey'])
|
@@ -105,8 +106,8 @@ module RGeo
|
|
105
106
|
assert_equal(0, rec_['TestDouble'])
|
106
107
|
end
|
107
108
|
end
|
108
|
-
|
109
|
-
|
109
|
+
|
110
|
+
|
110
111
|
def test_test0
|
111
112
|
_open_shapefile('test0') do |file_|
|
112
113
|
assert_equal(0, file_.shape_type_code)
|
@@ -120,8 +121,8 @@ module RGeo
|
|
120
121
|
assert_nil(file_.next)
|
121
122
|
end
|
122
123
|
end
|
123
|
-
|
124
|
-
|
124
|
+
|
125
|
+
|
125
126
|
def _test_point_shapefile(filename_, has_z_, has_m_)
|
126
127
|
_open_shapefile(filename_) do |file_|
|
127
128
|
assert_equal(has_z_ ? 11 : has_m_ ? 21 : 1, file_.shape_type_code)
|
@@ -145,23 +146,23 @@ module RGeo
|
|
145
146
|
assert_nil(file_.next)
|
146
147
|
end
|
147
148
|
end
|
148
|
-
|
149
|
-
|
149
|
+
|
150
|
+
|
150
151
|
def test_test1
|
151
152
|
_test_point_shapefile('test1', false, false)
|
152
153
|
end
|
153
|
-
|
154
|
-
|
154
|
+
|
155
|
+
|
155
156
|
def test_test2
|
156
157
|
_test_point_shapefile('test2', true, true)
|
157
158
|
end
|
158
|
-
|
159
|
-
|
159
|
+
|
160
|
+
|
160
161
|
def test_test3
|
161
162
|
_test_point_shapefile('test3', false, true)
|
162
163
|
end
|
163
|
-
|
164
|
-
|
164
|
+
|
165
|
+
|
165
166
|
def _test_multipoint_shapefile(filename_, has_z_, has_m_)
|
166
167
|
_open_shapefile(filename_) do |file_|
|
167
168
|
assert_equal(has_z_ ? 18 : has_m_ ? 28 : 8, file_.shape_type_code)
|
@@ -196,23 +197,23 @@ module RGeo
|
|
196
197
|
assert_nil(file_.next)
|
197
198
|
end
|
198
199
|
end
|
199
|
-
|
200
|
-
|
200
|
+
|
201
|
+
|
201
202
|
def test_test4
|
202
203
|
_test_multipoint_shapefile('test4', false, false)
|
203
204
|
end
|
204
|
-
|
205
|
-
|
205
|
+
|
206
|
+
|
206
207
|
def test_test5
|
207
208
|
_test_multipoint_shapefile('test5', true, true)
|
208
209
|
end
|
209
|
-
|
210
|
-
|
210
|
+
|
211
|
+
|
211
212
|
def test_test6
|
212
213
|
_test_multipoint_shapefile('test6', false, true)
|
213
214
|
end
|
214
|
-
|
215
|
-
|
215
|
+
|
216
|
+
|
216
217
|
def _test_polyline_shapefile(filename_, has_z_, has_m_)
|
217
218
|
_open_shapefile(filename_) do |file_|
|
218
219
|
assert_equal(has_z_ ? 13 : has_m_ ? 23 : 3, file_.shape_type_code)
|
@@ -306,23 +307,23 @@ module RGeo
|
|
306
307
|
assert_equal(28, rec_.geometry[2].point_n(4).m) if has_m_
|
307
308
|
end
|
308
309
|
end
|
309
|
-
|
310
|
-
|
310
|
+
|
311
|
+
|
311
312
|
def test_test7
|
312
313
|
_test_polyline_shapefile('test7', false, false)
|
313
314
|
end
|
314
|
-
|
315
|
-
|
315
|
+
|
316
|
+
|
316
317
|
def test_test8
|
317
318
|
_test_polyline_shapefile('test8', true, true)
|
318
319
|
end
|
319
|
-
|
320
|
-
|
320
|
+
|
321
|
+
|
321
322
|
def test_test9
|
322
323
|
_test_polyline_shapefile('test9', false, true)
|
323
324
|
end
|
324
|
-
|
325
|
-
|
325
|
+
|
326
|
+
|
326
327
|
def _test_polygon_shapefile(filename_, has_z_, has_m_)
|
327
328
|
_open_shapefile(filename_) do |file_|
|
328
329
|
assert_equal(has_z_ ? 15 : has_m_ ? 25 : 5, file_.shape_type_code)
|
@@ -419,30 +420,30 @@ module RGeo
|
|
419
420
|
assert_equal(28, rec_.geometry[0].interior_ring_n(1).point_n(4).m) if has_m_
|
420
421
|
end
|
421
422
|
end
|
422
|
-
|
423
|
-
|
423
|
+
|
424
|
+
|
424
425
|
def test_test10
|
425
426
|
_test_polygon_shapefile('test10', false, false)
|
426
427
|
end
|
427
|
-
|
428
|
-
|
428
|
+
|
429
|
+
|
429
430
|
def test_test11
|
430
431
|
_test_polygon_shapefile('test11', true, true)
|
431
432
|
end
|
432
|
-
|
433
|
-
|
433
|
+
|
434
|
+
|
434
435
|
def test_test12
|
435
436
|
_test_polygon_shapefile('test12', false, true)
|
436
437
|
end
|
437
|
-
|
438
|
-
|
438
|
+
|
439
|
+
|
439
440
|
def test_test13
|
440
441
|
_open_shapefile('test13') do |file_|
|
441
442
|
assert_equal(31, file_.shape_type_code)
|
442
443
|
assert_equal(4, file_.num_records)
|
443
444
|
assert_equal(true, file_.factory.property(:has_z_coordinate))
|
444
445
|
# I believe shapefile's test13 incorrectly includes bounding
|
445
|
-
# box data for m, since there is no actual m data. So I
|
446
|
+
# box data for m, since there is no actual m data. So I
|
446
447
|
# disabled this test:
|
447
448
|
# assert_equal(false, file_.factory.property(:has_m_coordinate))
|
448
449
|
rec_ = file_.next
|
@@ -518,10 +519,10 @@ module RGeo
|
|
518
519
|
assert_equal(14, rec_.geometry[0].interior_ring_n(1).point_n(4).z)
|
519
520
|
end
|
520
521
|
end
|
521
|
-
|
522
|
-
|
522
|
+
|
523
|
+
|
523
524
|
end
|
524
|
-
|
525
|
+
|
525
526
|
end
|
526
527
|
end
|
527
528
|
end
|
metadata
CHANGED
@@ -1,52 +1,52 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rgeo-shapefile
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.3
|
4
5
|
prerelease:
|
5
|
-
version: 0.2.2
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Daniel Azuma
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-01-10 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
16
15
|
name: rgeo
|
17
|
-
|
18
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &2152193220 !ruby/object:Gem::Requirement
|
19
17
|
none: false
|
20
|
-
requirements:
|
21
|
-
- -
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.3.3
|
24
22
|
type: :runtime
|
25
|
-
version_requirements: *id001
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
-
name: dbf
|
28
23
|
prerelease: false
|
29
|
-
|
24
|
+
version_requirements: *2152193220
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: dbf
|
27
|
+
requirement: &2152192700 !ruby/object:Gem::Requirement
|
30
28
|
none: false
|
31
|
-
requirements:
|
32
|
-
- -
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: 1.
|
35
|
-
type: :
|
36
|
-
|
37
|
-
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.7.0
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2152192700
|
36
|
+
description: RGeo is a geospatial data library for Ruby. RGeo::Shapefile is an optional
|
37
|
+
RGeo module for reading the ESRI shapefile format, a common file format for geospatial
|
38
|
+
datasets.
|
38
39
|
email: dazuma@gmail.com
|
39
40
|
executables: []
|
40
|
-
|
41
41
|
extensions: []
|
42
|
-
|
43
|
-
extra_rdoc_files:
|
42
|
+
extra_rdoc_files:
|
44
43
|
- History.rdoc
|
45
44
|
- README.rdoc
|
46
|
-
files:
|
45
|
+
files:
|
47
46
|
- lib/rgeo/shapefile/reader.rb
|
48
47
|
- lib/rgeo/shapefile/version.rb
|
49
48
|
- lib/rgeo/shapefile.rb
|
49
|
+
- lib/rgeo-shapefile.rb
|
50
50
|
- test/tc_basic.rb
|
51
51
|
- test/tc_shapelib_tests.rb
|
52
52
|
- test/shapelib_testcases/readme.txt
|
@@ -86,31 +86,28 @@ files:
|
|
86
86
|
- Version
|
87
87
|
homepage: http://virtuoso.rubyforge.org/rgeo-shapefile
|
88
88
|
licenses: []
|
89
|
-
|
90
89
|
post_install_message:
|
91
90
|
rdoc_options: []
|
92
|
-
|
93
|
-
require_paths:
|
91
|
+
require_paths:
|
94
92
|
- lib
|
95
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
94
|
none: false
|
97
|
-
requirements:
|
98
|
-
- -
|
99
|
-
- !ruby/object:Gem::Version
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
100
98
|
version: 1.8.7
|
101
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
100
|
none: false
|
103
|
-
requirements:
|
104
|
-
- -
|
105
|
-
- !ruby/object:Gem::Version
|
101
|
+
requirements:
|
102
|
+
- - ! '>'
|
103
|
+
- !ruby/object:Gem::Version
|
106
104
|
version: 1.3.1
|
107
105
|
requirements: []
|
108
|
-
|
109
106
|
rubyforge_project: virtuoso
|
110
|
-
rubygems_version: 1.
|
107
|
+
rubygems_version: 1.8.12
|
111
108
|
signing_key:
|
112
109
|
specification_version: 3
|
113
110
|
summary: An RGeo module for reading ESRI shapefiles.
|
114
|
-
test_files:
|
111
|
+
test_files:
|
115
112
|
- test/tc_basic.rb
|
116
113
|
- test/tc_shapelib_tests.rb
|