rgeo-shapefile 0.2.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/{History.rdoc → History.md} +19 -4
- data/{test/tc_basic.rb → LICENSE.txt} +1 -29
- data/README.md +99 -0
- data/lib/rgeo-shapefile.rb +0 -35
- data/lib/rgeo/shapefile.rb +0 -37
- data/lib/rgeo/shapefile/reader.rb +5 -44
- data/lib/rgeo/shapefile/version.rb +1 -48
- data/test/basic_test.rb +21 -0
- data/test/{tc_shapelib_tests.rb → shapelib_cases_test.rb} +2 -38
- metadata +101 -52
- data/README.rdoc +0 -106
- data/Version +0 -1
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c870cd7bc12960ff1abd0a7e7c137a7285cd6725
|
4
|
+
data.tar.gz: ec570ff22df0b91f60d8ea116596879b518847ce
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 13fcadbc4f1f2ed1910636ac6fd87cba36e6d18513ecf87e5659550d9a31f2b3ff52a80b93bc590347d32e39e5c5a674a2562843b38eb39391ad615af8f08653
|
7
|
+
data.tar.gz: cf33203550cce003b4088b6e4148e6dd1e86e9263fa3734e30ff83fb0ca34619347627a51f05a293ec9b554b80af30231047b27a9cb757dfc62dc7f8dfe35504
|
data/{History.rdoc → History.md}
RENAMED
@@ -1,20 +1,35 @@
|
|
1
|
-
|
1
|
+
### 0.3.0 / 2014-07-01
|
2
|
+
|
3
|
+
* Require ruby 1.9.3+
|
4
|
+
* Moved into rgeo org on github.
|
5
|
+
* Update development environment to match other rgeo projects.
|
6
|
+
|
7
|
+
### 0.2.5 / unreleased
|
8
|
+
|
9
|
+
* The gemspec no longer includes the timestamp in the version, so that bundler can pull from github. (Reported by corneverbruggen)
|
10
|
+
|
11
|
+
### 0.2.4 / unreleased
|
12
|
+
|
13
|
+
* Fixed a few warnings
|
14
|
+
* Travis CI integration.
|
15
|
+
|
16
|
+
### 0.2.3 / 2012-01-09
|
2
17
|
|
3
18
|
* The dbf gem is now a hard dependency (now that it no longer pulls in ActiveSupport).
|
4
19
|
* Reader#initialize no longer tries to modify its parameters in place. (Reported by Brad Johnson.)
|
5
20
|
* DBF column reading should be more robust. (Possible fix for GH-4, reported by michael-groble.)
|
6
21
|
* Added an "rgeo-shapefile.rb" wrapper so bundler's auto-require will work without modification. (Reported by Mauricio Pasquier Juan.)
|
7
22
|
|
8
|
-
|
23
|
+
### 0.2.2 / 2011-04-11
|
9
24
|
|
10
25
|
* A .gemspec file is now available for gem building and bundler git integration.
|
11
26
|
|
12
|
-
|
27
|
+
### 0.2.1 / 2011-03-31
|
13
28
|
|
14
29
|
* The gem version is now accessible via an api.
|
15
30
|
* Attributes were each listed twice under slightly different names. Fixed. (Reported by spara.)
|
16
31
|
|
17
|
-
|
32
|
+
### 0.2.0 / 2010-12-07
|
18
33
|
|
19
34
|
* Initial public alpha release. Spun rgeo-shapefile off from the core rgeo gem.
|
20
35
|
* Removed the :default_factory option, for consistency with the other modules.
|
@@ -1,9 +1,5 @@
|
|
1
1
|
# -----------------------------------------------------------------------------
|
2
|
-
#
|
3
|
-
# Some shapefile reading test cases borrowed from shapelib
|
4
|
-
#
|
5
|
-
# -----------------------------------------------------------------------------
|
6
|
-
# Copyright 2010-2012 Daniel Azuma
|
2
|
+
# Copyright 2014 Daniel Azuma
|
7
3
|
#
|
8
4
|
# All rights reserved.
|
9
5
|
#
|
@@ -31,27 +27,3 @@
|
|
31
27
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32
28
|
# POSSIBILITY OF SUCH DAMAGE.
|
33
29
|
# -----------------------------------------------------------------------------
|
34
|
-
;
|
35
|
-
|
36
|
-
|
37
|
-
require 'test/unit'
|
38
|
-
require 'rgeo/shapefile'
|
39
|
-
|
40
|
-
|
41
|
-
module RGeo
|
42
|
-
module Shapefile
|
43
|
-
module Tests # :nodoc:
|
44
|
-
|
45
|
-
class TestBasic < ::Test::Unit::TestCase # :nodoc:
|
46
|
-
|
47
|
-
|
48
|
-
def test_has_version
|
49
|
-
assert_not_nil(::RGeo::Shapefile::VERSION)
|
50
|
-
end
|
51
|
-
|
52
|
-
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
data/README.md
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
# RGeo::Shapefile
|
2
|
+
|
3
|
+
[](http://badge.fury.io/rb/rgeo-shapefile)
|
4
|
+
[](https://travis-ci.org/rgeo/rgeo-shapefile)
|
5
|
+
|
6
|
+
`RGeo::Shapefile` is an optional module for [RGeo](http://github.com/dazuma/rgeo)
|
7
|
+
for reading geospatial data from ESRI shapefiles.
|
8
|
+
|
9
|
+
## Summary
|
10
|
+
|
11
|
+
RGeo is a key component for writing location-aware applications in the
|
12
|
+
Ruby programming language. At its core is an implementation of the
|
13
|
+
industry standard OGC Simple Features Specification, which provides data
|
14
|
+
representations of geometric objects such as points, lines, and polygons,
|
15
|
+
along with a set of geometric analysis operations. See the README for the
|
16
|
+
"rgeo" gem for more information.
|
17
|
+
|
18
|
+
`RGeo::Shapefile` is an optional RGeo add-on module for reading geospatial
|
19
|
+
data from ESRI shapefiles. The shapefile format is a common file format
|
20
|
+
for geospatial data sets. It is specified in
|
21
|
+
[this ESRI whitepaper](http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf).
|
22
|
+
|
23
|
+
Example:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
require 'rgeo/shapefile'
|
27
|
+
|
28
|
+
RGeo::Shapefile::Reader.open('myshpfil.shp') do |file|
|
29
|
+
puts "File contains #{file.num_records} records."
|
30
|
+
file.each do |record|
|
31
|
+
puts "Record number #{record.index}:"
|
32
|
+
puts " Geometry: #{record.geometry.as_text}"
|
33
|
+
puts " Attributes: #{record.attributes.inspect}"
|
34
|
+
end
|
35
|
+
file.rewind
|
36
|
+
record = file.next
|
37
|
+
puts "First record geometry was: #{record.geometry.as_text}"
|
38
|
+
end
|
39
|
+
```
|
40
|
+
|
41
|
+
## Install
|
42
|
+
|
43
|
+
`RGeo::Shapefile` has the following requirements:
|
44
|
+
|
45
|
+
* Ruby 1.9.3 or later preferred.
|
46
|
+
* rgeo 0.3.13 or later.
|
47
|
+
* dbf 1.7 or later.
|
48
|
+
|
49
|
+
Include in your bundle:
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
gem 'rgeo-shapefile'
|
53
|
+
```
|
54
|
+
|
55
|
+
Install `RGeo::Shapefile` as a gem:
|
56
|
+
|
57
|
+
```sh
|
58
|
+
gem install rgeo
|
59
|
+
gem install rgeo-shapefile
|
60
|
+
```
|
61
|
+
|
62
|
+
See the README for the "rgeo" gem, a required dependency, for further installation information.
|
63
|
+
|
64
|
+
If you are using Ruby 1.8, use version `0.2.x` of this gem.
|
65
|
+
|
66
|
+
## To-do list
|
67
|
+
|
68
|
+
* Improve test case coverage.
|
69
|
+
* Support for writing shapefiles.
|
70
|
+
|
71
|
+
## Development and support
|
72
|
+
|
73
|
+
Documentation is available at http://rdoc.info/gems/rgeo-shapefile
|
74
|
+
|
75
|
+
Source code is hosted on Github at http://github.com/rgeo/rgeo-shapefile
|
76
|
+
|
77
|
+
Contributions are welcome. Fork the project on Github.
|
78
|
+
|
79
|
+
Report bugs on Github issues at http://github.org/rgeo/rgeo-shapefile/issues
|
80
|
+
|
81
|
+
## Acknowledgments
|
82
|
+
|
83
|
+
RGeo is written by Daniel Azuma (http://www.daniel-azuma.com).
|
84
|
+
|
85
|
+
Development is supported by:
|
86
|
+
|
87
|
+
* [Pirq](http://www.pirq.com)
|
88
|
+
* [Neighborland](https://neighborland.com)
|
89
|
+
|
90
|
+
Although we don't use shapelib (http://shapelib.maptools.org) to read
|
91
|
+
ESRI shapefiles, we did borrow a bunch of their test cases.
|
92
|
+
|
93
|
+
=== License
|
94
|
+
|
95
|
+
Copyright 2014 Daniel Azuma
|
96
|
+
|
97
|
+
Copyright 2014 Tee Parham
|
98
|
+
|
99
|
+
https://github.com/rgeo/rgeo-shapefile/blob/master/LICENSE.txt
|
data/lib/rgeo-shapefile.rb
CHANGED
@@ -1,36 +1 @@
|
|
1
|
-
# -----------------------------------------------------------------------------
|
2
|
-
#
|
3
|
-
# Shapefile processing for RGeo
|
4
|
-
#
|
5
|
-
# -----------------------------------------------------------------------------
|
6
|
-
# Copyright 2010-2012 Daniel Azuma
|
7
|
-
#
|
8
|
-
# All rights reserved.
|
9
|
-
#
|
10
|
-
# Redistribution and use in source and binary forms, with or without
|
11
|
-
# modification, are permitted provided that the following conditions are met:
|
12
|
-
#
|
13
|
-
# * Redistributions of source code must retain the above copyright notice,
|
14
|
-
# this list of conditions and the following disclaimer.
|
15
|
-
# * Redistributions in binary form must reproduce the above copyright notice,
|
16
|
-
# this list of conditions and the following disclaimer in the documentation
|
17
|
-
# and/or other materials provided with the distribution.
|
18
|
-
# * Neither the name of the copyright holder, nor the names of any other
|
19
|
-
# contributors to this software, may be used to endorse or promote products
|
20
|
-
# derived from this software without specific prior written permission.
|
21
|
-
#
|
22
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
23
|
-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
24
|
-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
25
|
-
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
26
|
-
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
27
|
-
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
28
|
-
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
29
|
-
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
30
|
-
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
31
|
-
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32
|
-
# POSSIBILITY OF SUCH DAMAGE.
|
33
|
-
# -----------------------------------------------------------------------------
|
34
|
-
;
|
35
|
-
|
36
1
|
require 'rgeo/shapefile'
|
data/lib/rgeo/shapefile.rb
CHANGED
@@ -1,40 +1,3 @@
|
|
1
|
-
# -----------------------------------------------------------------------------
|
2
|
-
#
|
3
|
-
# Shapefile processing for RGeo
|
4
|
-
#
|
5
|
-
# -----------------------------------------------------------------------------
|
6
|
-
# Copyright 2010-2012 Daniel Azuma
|
7
|
-
#
|
8
|
-
# All rights reserved.
|
9
|
-
#
|
10
|
-
# Redistribution and use in source and binary forms, with or without
|
11
|
-
# modification, are permitted provided that the following conditions are met:
|
12
|
-
#
|
13
|
-
# * Redistributions of source code must retain the above copyright notice,
|
14
|
-
# this list of conditions and the following disclaimer.
|
15
|
-
# * Redistributions in binary form must reproduce the above copyright notice,
|
16
|
-
# this list of conditions and the following disclaimer in the documentation
|
17
|
-
# and/or other materials provided with the distribution.
|
18
|
-
# * Neither the name of the copyright holder, nor the names of any other
|
19
|
-
# contributors to this software, may be used to endorse or promote products
|
20
|
-
# derived from this software without specific prior written permission.
|
21
|
-
#
|
22
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
23
|
-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
24
|
-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
25
|
-
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
26
|
-
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
27
|
-
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
28
|
-
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
29
|
-
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
30
|
-
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
31
|
-
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32
|
-
# POSSIBILITY OF SUCH DAMAGE.
|
33
|
-
# -----------------------------------------------------------------------------
|
34
|
-
;
|
35
|
-
|
36
|
-
|
37
|
-
# Dependencies
|
38
1
|
require 'rgeo'
|
39
2
|
|
40
3
|
|
@@ -1,43 +1,4 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
# Shapefile reader for RGeo
|
4
|
-
#
|
5
|
-
# -----------------------------------------------------------------------------
|
6
|
-
# Copyright 2010-2012 Daniel Azuma
|
7
|
-
#
|
8
|
-
# All rights reserved.
|
9
|
-
#
|
10
|
-
# Redistribution and use in source and binary forms, with or without
|
11
|
-
# modification, are permitted provided that the following conditions are met:
|
12
|
-
#
|
13
|
-
# * Redistributions of source code must retain the above copyright notice,
|
14
|
-
# this list of conditions and the following disclaimer.
|
15
|
-
# * Redistributions in binary form must reproduce the above copyright notice,
|
16
|
-
# this list of conditions and the following disclaimer in the documentation
|
17
|
-
# and/or other materials provided with the distribution.
|
18
|
-
# * Neither the name of the copyright holder, nor the names of any other
|
19
|
-
# contributors to this software, may be used to endorse or promote products
|
20
|
-
# derived from this software without specific prior written permission.
|
21
|
-
#
|
22
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
23
|
-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
24
|
-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
25
|
-
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
26
|
-
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
27
|
-
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
28
|
-
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
29
|
-
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
30
|
-
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
31
|
-
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32
|
-
# POSSIBILITY OF SUCH DAMAGE.
|
33
|
-
# -----------------------------------------------------------------------------
|
34
|
-
;
|
35
|
-
|
36
|
-
|
37
|
-
begin
|
38
|
-
require 'dbf'
|
39
|
-
rescue ::LoadError => ex_
|
40
|
-
end
|
1
|
+
require 'dbf'
|
41
2
|
|
42
3
|
|
43
4
|
module RGeo
|
@@ -225,7 +186,7 @@ module RGeo
|
|
225
186
|
@opened = true
|
226
187
|
@main_file = ::File.open(path_+'.shp', 'rb:ascii-8bit')
|
227
188
|
@index_file = ::File.open(path_+'.shx', 'rb:ascii-8bit')
|
228
|
-
if
|
189
|
+
if ::File.file?(path_+'.dbf') && ::File.readable?(path_+'.dbf')
|
229
190
|
@attr_dbf = ::DBF::Table.new(path_+'.dbf')
|
230
191
|
else
|
231
192
|
@attr_dbf = nil
|
@@ -443,7 +404,7 @@ module RGeo
|
|
443
404
|
|
444
405
|
|
445
406
|
def _read_next_record # :nodoc:
|
446
|
-
|
407
|
+
length_ = @main_file.read(8).unpack('NN')[1]
|
447
408
|
data_ = @main_file.read(length_ * 2)
|
448
409
|
shape_type_ = data_[0,4].unpack('V').first
|
449
410
|
geometry_ =
|
@@ -821,11 +782,11 @@ module RGeo
|
|
821
782
|
geos_polygons_ = sequence_.map{ |ring_| geos_factory_.polygon(ring_) }
|
822
783
|
outer_poly_ = nil
|
823
784
|
outer_index_ = 0
|
824
|
-
geos_polygons_.each_with_index do |poly_,
|
785
|
+
geos_polygons_.each_with_index do |poly_, idx_|
|
825
786
|
if outer_poly_
|
826
787
|
if poly_.contains?(outer_poly_)
|
827
788
|
outer_poly_ = poly_
|
828
|
-
outer_index_ =
|
789
|
+
outer_index_ = idx_
|
829
790
|
break;
|
830
791
|
end
|
831
792
|
else
|
@@ -1,55 +1,8 @@
|
|
1
|
-
# -----------------------------------------------------------------------------
|
2
|
-
#
|
3
|
-
# Version of rgeo-shapefile
|
4
|
-
#
|
5
|
-
# -----------------------------------------------------------------------------
|
6
|
-
# Copyright 2010-2012 Daniel Azuma
|
7
|
-
#
|
8
|
-
# All rights reserved.
|
9
|
-
#
|
10
|
-
# Redistribution and use in source and binary forms, with or without
|
11
|
-
# modification, are permitted provided that the following conditions are met:
|
12
|
-
#
|
13
|
-
# * Redistributions of source code must retain the above copyright notice,
|
14
|
-
# this list of conditions and the following disclaimer.
|
15
|
-
# * Redistributions in binary form must reproduce the above copyright notice,
|
16
|
-
# this list of conditions and the following disclaimer in the documentation
|
17
|
-
# and/or other materials provided with the distribution.
|
18
|
-
# * Neither the name of the copyright holder, nor the names of any other
|
19
|
-
# contributors to this software, may be used to endorse or promote products
|
20
|
-
# derived from this software without specific prior written permission.
|
21
|
-
#
|
22
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
23
|
-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
24
|
-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
25
|
-
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
26
|
-
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
27
|
-
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
28
|
-
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
29
|
-
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
30
|
-
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
31
|
-
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32
|
-
# POSSIBILITY OF SUCH DAMAGE.
|
33
|
-
# -----------------------------------------------------------------------------
|
34
|
-
;
|
35
|
-
|
36
|
-
|
37
|
-
begin
|
38
|
-
require 'versionomy'
|
39
|
-
rescue ::LoadError
|
40
|
-
end
|
41
|
-
|
42
|
-
|
43
1
|
module RGeo
|
44
2
|
|
45
3
|
module Shapefile
|
46
4
|
|
47
|
-
|
48
|
-
VERSION_STRING = ::File.read(::File.dirname(__FILE__)+'/../../../Version').strip.freeze
|
49
|
-
|
50
|
-
# Current version of RGeo::Shapefile as a Versionomy object, if the
|
51
|
-
# Versionomy gem is available; otherwise equal to VERSION_STRING.
|
52
|
-
VERSION = defined?(::Versionomy) ? ::Versionomy.parse(VERSION_STRING) : VERSION_STRING
|
5
|
+
VERSION = '0.3.0'.freeze
|
53
6
|
|
54
7
|
end
|
55
8
|
|
data/test/basic_test.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'rgeo/shapefile'
|
3
|
+
|
4
|
+
|
5
|
+
module RGeo
|
6
|
+
module Shapefile
|
7
|
+
module Tests # :nodoc:
|
8
|
+
|
9
|
+
class BasicTest < ::Minitest::Test # :nodoc:
|
10
|
+
|
11
|
+
|
12
|
+
def test_has_version
|
13
|
+
refute_nil(::RGeo::Shapefile::VERSION)
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -1,40 +1,4 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
# Some shapefile reading test cases borrowed from shapelib
|
4
|
-
#
|
5
|
-
# -----------------------------------------------------------------------------
|
6
|
-
# Copyright 2010-2012 Daniel Azuma
|
7
|
-
#
|
8
|
-
# All rights reserved.
|
9
|
-
#
|
10
|
-
# Redistribution and use in source and binary forms, with or without
|
11
|
-
# modification, are permitted provided that the following conditions are met:
|
12
|
-
#
|
13
|
-
# * Redistributions of source code must retain the above copyright notice,
|
14
|
-
# this list of conditions and the following disclaimer.
|
15
|
-
# * Redistributions in binary form must reproduce the above copyright notice,
|
16
|
-
# this list of conditions and the following disclaimer in the documentation
|
17
|
-
# and/or other materials provided with the distribution.
|
18
|
-
# * Neither the name of the copyright holder, nor the names of any other
|
19
|
-
# contributors to this software, may be used to endorse or promote products
|
20
|
-
# derived from this software without specific prior written permission.
|
21
|
-
#
|
22
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
23
|
-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
24
|
-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
25
|
-
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
26
|
-
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
27
|
-
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
28
|
-
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
29
|
-
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
30
|
-
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
31
|
-
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32
|
-
# POSSIBILITY OF SUCH DAMAGE.
|
33
|
-
# -----------------------------------------------------------------------------
|
34
|
-
;
|
35
|
-
|
36
|
-
|
37
|
-
require 'test/unit'
|
1
|
+
require 'minitest/autorun'
|
38
2
|
require 'rgeo/shapefile'
|
39
3
|
|
40
4
|
|
@@ -42,7 +6,7 @@ module RGeo
|
|
42
6
|
module Shapefile
|
43
7
|
module Tests # :nodoc:
|
44
8
|
|
45
|
-
class
|
9
|
+
class ShapelibCasesTest < ::Minitest::Test # :nodoc:
|
46
10
|
|
47
11
|
def _open_shapefile(name_, &block_)
|
48
12
|
RGeo::Shapefile::Reader.open(::File.expand_path("shapelib_testcases/#{name_}", ::File.dirname(__FILE__)), &block_)
|
metadata
CHANGED
@@ -1,113 +1,162 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rgeo-shapefile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Daniel Azuma
|
8
|
+
- Tee Parham
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-02-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rgeo
|
16
|
-
requirement:
|
17
|
-
none: false
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
18
17
|
requirements:
|
19
|
-
- -
|
18
|
+
- - "~>"
|
20
19
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.3
|
20
|
+
version: '0.3'
|
22
21
|
type: :runtime
|
23
22
|
prerelease: false
|
24
|
-
version_requirements:
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0.3'
|
25
28
|
- !ruby/object:Gem::Dependency
|
26
29
|
name: dbf
|
27
|
-
requirement:
|
28
|
-
none: false
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
29
31
|
requirements:
|
30
|
-
- -
|
32
|
+
- - "~>"
|
31
33
|
- !ruby/object:Gem::Version
|
32
|
-
version: 1.7
|
34
|
+
version: '1.7'
|
33
35
|
type: :runtime
|
34
36
|
prerelease: false
|
35
|
-
version_requirements:
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.7'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: bundler
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '1.6'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '1.6'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: minitest
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '5.3'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '5.3'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rake
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '10.3'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '10.3'
|
36
84
|
description: RGeo is a geospatial data library for Ruby. RGeo::Shapefile is an optional
|
37
85
|
RGeo module for reading the ESRI shapefile format, a common file format for geospatial
|
38
86
|
datasets.
|
39
|
-
email:
|
87
|
+
email:
|
88
|
+
- dazuma@gmail.com
|
89
|
+
- parhameter@gmail.com
|
40
90
|
executables: []
|
41
91
|
extensions: []
|
42
|
-
extra_rdoc_files:
|
43
|
-
- History.rdoc
|
44
|
-
- README.rdoc
|
92
|
+
extra_rdoc_files: []
|
45
93
|
files:
|
94
|
+
- History.md
|
95
|
+
- LICENSE.txt
|
96
|
+
- README.md
|
97
|
+
- lib/rgeo-shapefile.rb
|
98
|
+
- lib/rgeo/shapefile.rb
|
46
99
|
- lib/rgeo/shapefile/reader.rb
|
47
100
|
- lib/rgeo/shapefile/version.rb
|
48
|
-
-
|
49
|
-
-
|
50
|
-
- test/tc_basic.rb
|
51
|
-
- test/tc_shapelib_tests.rb
|
101
|
+
- test/basic_test.rb
|
102
|
+
- test/shapelib_cases_test.rb
|
52
103
|
- test/shapelib_testcases/readme.txt
|
104
|
+
- test/shapelib_testcases/test.dbf
|
53
105
|
- test/shapelib_testcases/test.shp
|
54
|
-
- test/shapelib_testcases/test0.shp
|
55
|
-
- test/shapelib_testcases/test1.shp
|
56
|
-
- test/shapelib_testcases/test10.shp
|
57
|
-
- test/shapelib_testcases/test11.shp
|
58
|
-
- test/shapelib_testcases/test12.shp
|
59
|
-
- test/shapelib_testcases/test13.shp
|
60
|
-
- test/shapelib_testcases/test2.shp
|
61
|
-
- test/shapelib_testcases/test3.shp
|
62
|
-
- test/shapelib_testcases/test4.shp
|
63
|
-
- test/shapelib_testcases/test5.shp
|
64
|
-
- test/shapelib_testcases/test6.shp
|
65
|
-
- test/shapelib_testcases/test7.shp
|
66
|
-
- test/shapelib_testcases/test8.shp
|
67
|
-
- test/shapelib_testcases/test9.shp
|
68
106
|
- test/shapelib_testcases/test.shx
|
107
|
+
- test/shapelib_testcases/test0.shp
|
69
108
|
- test/shapelib_testcases/test0.shx
|
109
|
+
- test/shapelib_testcases/test1.shp
|
70
110
|
- test/shapelib_testcases/test1.shx
|
111
|
+
- test/shapelib_testcases/test10.shp
|
71
112
|
- test/shapelib_testcases/test10.shx
|
113
|
+
- test/shapelib_testcases/test11.shp
|
72
114
|
- test/shapelib_testcases/test11.shx
|
115
|
+
- test/shapelib_testcases/test12.shp
|
73
116
|
- test/shapelib_testcases/test12.shx
|
117
|
+
- test/shapelib_testcases/test13.shp
|
74
118
|
- test/shapelib_testcases/test13.shx
|
119
|
+
- test/shapelib_testcases/test2.shp
|
75
120
|
- test/shapelib_testcases/test2.shx
|
121
|
+
- test/shapelib_testcases/test3.shp
|
76
122
|
- test/shapelib_testcases/test3.shx
|
123
|
+
- test/shapelib_testcases/test4.shp
|
77
124
|
- test/shapelib_testcases/test4.shx
|
125
|
+
- test/shapelib_testcases/test5.shp
|
78
126
|
- test/shapelib_testcases/test5.shx
|
127
|
+
- test/shapelib_testcases/test6.shp
|
79
128
|
- test/shapelib_testcases/test6.shx
|
129
|
+
- test/shapelib_testcases/test7.shp
|
80
130
|
- test/shapelib_testcases/test7.shx
|
131
|
+
- test/shapelib_testcases/test8.shp
|
81
132
|
- test/shapelib_testcases/test8.shx
|
133
|
+
- test/shapelib_testcases/test9.shp
|
82
134
|
- test/shapelib_testcases/test9.shx
|
83
|
-
|
84
|
-
|
85
|
-
-
|
86
|
-
|
87
|
-
homepage: http://virtuoso.rubyforge.org/rgeo-shapefile
|
88
|
-
licenses: []
|
135
|
+
homepage: http://github.com/rgeo/rgeo-geojson
|
136
|
+
licenses:
|
137
|
+
- BSD
|
138
|
+
metadata: {}
|
89
139
|
post_install_message:
|
90
140
|
rdoc_options: []
|
91
141
|
require_paths:
|
92
142
|
- lib
|
93
143
|
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
-
none: false
|
95
144
|
requirements:
|
96
|
-
- -
|
145
|
+
- - ">="
|
97
146
|
- !ruby/object:Gem::Version
|
98
|
-
version: 1.
|
147
|
+
version: 1.9.3
|
99
148
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
-
none: false
|
101
149
|
requirements:
|
102
|
-
- -
|
150
|
+
- - ">="
|
103
151
|
- !ruby/object:Gem::Version
|
104
|
-
version:
|
152
|
+
version: '0'
|
105
153
|
requirements: []
|
106
|
-
rubyforge_project:
|
107
|
-
rubygems_version:
|
154
|
+
rubyforge_project:
|
155
|
+
rubygems_version: 2.5.1
|
108
156
|
signing_key:
|
109
|
-
specification_version:
|
157
|
+
specification_version: 4
|
110
158
|
summary: An RGeo module for reading ESRI shapefiles.
|
111
159
|
test_files:
|
112
|
-
- test/
|
113
|
-
- test/
|
160
|
+
- test/basic_test.rb
|
161
|
+
- test/shapelib_cases_test.rb
|
162
|
+
has_rdoc:
|
data/README.rdoc
DELETED
@@ -1,106 +0,0 @@
|
|
1
|
-
== RGeo::Shapefile
|
2
|
-
|
3
|
-
RGeo::Shapefile is an optional module for {RGeo}[http://github.com/dazuma/rgeo]
|
4
|
-
for reading geospatial data from ESRI shapefiles.
|
5
|
-
|
6
|
-
=== Summary
|
7
|
-
|
8
|
-
\RGeo is a key component for writing location-aware applications in the
|
9
|
-
Ruby programming language. At its core is an implementation of the
|
10
|
-
industry standard OGC Simple Features Specification, which provides data
|
11
|
-
representations of geometric objects such as points, lines, and polygons,
|
12
|
-
along with a set of geometric analysis operations. See the README for the
|
13
|
-
"rgeo" gem for more information.
|
14
|
-
|
15
|
-
RGeo::Shapefile is an optional \RGeo add-on module for reading geospatial
|
16
|
-
data from ESRI shapefiles. The shapefile format is a common file format
|
17
|
-
for geospatial data sets. It is specified in
|
18
|
-
{this ESRI whitepaper}[http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf].
|
19
|
-
|
20
|
-
Example:
|
21
|
-
|
22
|
-
require 'rgeo/shapefile'
|
23
|
-
|
24
|
-
RGeo::Shapefile::Reader.open('myshpfil.shp') do |file|
|
25
|
-
puts "File contains #{file.num_records} records."
|
26
|
-
file.each do |record|
|
27
|
-
puts "Record number #{record.index}:"
|
28
|
-
puts " Geometry: #{record.geometry.as_text}"
|
29
|
-
puts " Attributes: #{record.attributes.inspect}"
|
30
|
-
end
|
31
|
-
file.rewind
|
32
|
-
record = file.next
|
33
|
-
puts "First record geometry was: #{record.geometry.as_text}"
|
34
|
-
end
|
35
|
-
|
36
|
-
=== Installation
|
37
|
-
|
38
|
-
RGeo::Shapefile has the following requirements:
|
39
|
-
|
40
|
-
* Ruby 1.8.7 or later. Ruby 1.9.2 or later preferred.
|
41
|
-
* rgeo 0.3.3 or later.
|
42
|
-
* dbf 1.7 or later.
|
43
|
-
|
44
|
-
Install RGeo::Shapefile as a gem:
|
45
|
-
|
46
|
-
gem install rgeo
|
47
|
-
gem install rgeo-shapefile
|
48
|
-
|
49
|
-
See the README for the "rgeo" gem, a required dependency, for further
|
50
|
-
installation information.
|
51
|
-
|
52
|
-
=== To-do list
|
53
|
-
|
54
|
-
* Improve test case coverage.
|
55
|
-
* Support for writing shapefiles.
|
56
|
-
|
57
|
-
=== Development and support
|
58
|
-
|
59
|
-
Documentation is available at http://virtuoso.rubyforge.org/rgeo-shapefile/README_rdoc.html
|
60
|
-
|
61
|
-
Source code is hosted on Github at http://github.com/dazuma/rgeo-shapefile
|
62
|
-
|
63
|
-
Contributions are welcome. Fork the project on Github.
|
64
|
-
|
65
|
-
Report bugs on Github issues at http://github.org/dazuma/rgeo-shapefile/issues
|
66
|
-
|
67
|
-
Contact the author at dazuma at gmail dot com.
|
68
|
-
|
69
|
-
=== Acknowledgments
|
70
|
-
|
71
|
-
\RGeo is written by Daniel Azuma (http://www.daniel-azuma.com).
|
72
|
-
|
73
|
-
Development of \RGeo is sponsored by GeoPage, Inc. (http://www.geopage.com).
|
74
|
-
|
75
|
-
Although we don't use shapelib (http://shapelib.maptools.org) to read
|
76
|
-
ESRI shapefiles, we did borrow a bunch of their test cases.
|
77
|
-
|
78
|
-
=== License
|
79
|
-
|
80
|
-
Copyright 2010-2012 Daniel Azuma
|
81
|
-
|
82
|
-
All rights reserved.
|
83
|
-
|
84
|
-
Redistribution and use in source and binary forms, with or without
|
85
|
-
modification, are permitted provided that the following conditions are met:
|
86
|
-
|
87
|
-
* Redistributions of source code must retain the above copyright notice,
|
88
|
-
this list of conditions and the following disclaimer.
|
89
|
-
* Redistributions in binary form must reproduce the above copyright notice,
|
90
|
-
this list of conditions and the following disclaimer in the documentation
|
91
|
-
and/or other materials provided with the distribution.
|
92
|
-
* Neither the name of the copyright holder, nor the names of any other
|
93
|
-
contributors to this software, may be used to endorse or promote products
|
94
|
-
derived from this software without specific prior written permission.
|
95
|
-
|
96
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
97
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
98
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
99
|
-
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
100
|
-
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
101
|
-
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
102
|
-
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
103
|
-
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
104
|
-
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
105
|
-
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
106
|
-
POSSIBILITY OF SUCH DAMAGE.
|
data/Version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.2.3
|