georuby 1.9.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +8 -0
- data/Gemfile.lock +29 -0
- data/History.txt +4 -0
- data/LICENSE +21 -0
- data/README.rdoc +184 -0
- data/Rakefile +48 -0
- data/VERSION +1 -0
- data/georuby.gemspec +128 -0
- data/lib/geo_ruby.rb +23 -0
- data/lib/geo_ruby/geojson.rb +129 -0
- data/lib/geo_ruby/georss.rb +133 -0
- data/lib/geo_ruby/gpx.rb +1 -0
- data/lib/geo_ruby/gpx4r/gpx.rb +118 -0
- data/lib/geo_ruby/shp.rb +1 -0
- data/lib/geo_ruby/shp4r/dbf.rb +42 -0
- data/lib/geo_ruby/shp4r/shp.rb +718 -0
- data/lib/geo_ruby/simple_features/envelope.rb +167 -0
- data/lib/geo_ruby/simple_features/ewkb_parser.rb +218 -0
- data/lib/geo_ruby/simple_features/ewkt_parser.rb +336 -0
- data/lib/geo_ruby/simple_features/geometry.rb +236 -0
- data/lib/geo_ruby/simple_features/geometry_collection.rb +144 -0
- data/lib/geo_ruby/simple_features/geometry_factory.rb +81 -0
- data/lib/geo_ruby/simple_features/helper.rb +18 -0
- data/lib/geo_ruby/simple_features/line_string.rb +228 -0
- data/lib/geo_ruby/simple_features/linear_ring.rb +34 -0
- data/lib/geo_ruby/simple_features/multi_line_string.rb +63 -0
- data/lib/geo_ruby/simple_features/multi_point.rb +58 -0
- data/lib/geo_ruby/simple_features/multi_polygon.rb +64 -0
- data/lib/geo_ruby/simple_features/point.rb +381 -0
- data/lib/geo_ruby/simple_features/polygon.rb +175 -0
- data/nofxx-georuby.gemspec +149 -0
- data/spec/data/geojson/feature_collection.json +34 -0
- data/spec/data/georss/atom.xml +21 -0
- data/spec/data/georss/gml.xml +40 -0
- data/spec/data/georss/w3c.xml +22 -0
- data/spec/data/gpx/fells_loop.gpx +1077 -0
- data/spec/data/gpx/long.gpx +1642 -0
- data/spec/data/gpx/long.kml +31590 -0
- data/spec/data/gpx/long.nmea +2220 -0
- data/spec/data/gpx/short.gpx +13634 -0
- data/spec/data/gpx/short.kml +130 -0
- data/spec/data/gpx/tracktreks.gpx +706 -0
- data/spec/data/multipoint.dbf +0 -0
- data/spec/data/multipoint.shp +0 -0
- data/spec/data/multipoint.shx +0 -0
- data/spec/data/point.dbf +0 -0
- data/spec/data/point.shp +0 -0
- data/spec/data/point.shx +0 -0
- data/spec/data/polygon.dbf +0 -0
- data/spec/data/polygon.shp +0 -0
- data/spec/data/polygon.shx +0 -0
- data/spec/data/polyline.dbf +0 -0
- data/spec/data/polyline.shp +0 -0
- data/spec/data/polyline.shx +0 -0
- data/spec/geo_ruby/geojson_spec.rb +147 -0
- data/spec/geo_ruby/georss.rb +218 -0
- data/spec/geo_ruby/georss_spec.rb +14 -0
- data/spec/geo_ruby/gpx4r/gpx_spec.rb +106 -0
- data/spec/geo_ruby/shp4r/shp_spec.rb +239 -0
- data/spec/geo_ruby/simple_features/envelope_spec.rb +47 -0
- data/spec/geo_ruby/simple_features/ewkb_parser_spec.rb +158 -0
- data/spec/geo_ruby/simple_features/ewkt_parser_spec.rb +179 -0
- data/spec/geo_ruby/simple_features/geometry_collection_spec.rb +55 -0
- data/spec/geo_ruby/simple_features/geometry_factory_spec.rb +11 -0
- data/spec/geo_ruby/simple_features/geometry_spec.rb +32 -0
- data/spec/geo_ruby/simple_features/line_string_spec.rb +259 -0
- data/spec/geo_ruby/simple_features/linear_ring_spec.rb +24 -0
- data/spec/geo_ruby/simple_features/multi_line_string_spec.rb +54 -0
- data/spec/geo_ruby/simple_features/multi_point_spec.rb +35 -0
- data/spec/geo_ruby/simple_features/multi_polygon_spec.rb +50 -0
- data/spec/geo_ruby/simple_features/point_spec.rb +356 -0
- data/spec/geo_ruby/simple_features/polygon_spec.rb +122 -0
- data/spec/geo_ruby_spec.rb +27 -0
- data/spec/spec_helper.rb +73 -0
- metadata +228 -0
@@ -0,0 +1,27 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
# Time to add your specs!
|
4
|
+
# http://rspec.info/
|
5
|
+
describe "GeoRuby Stuff" do
|
6
|
+
|
7
|
+
it "should instantiate Geometry" do
|
8
|
+
@geo = GeoRuby::SimpleFeatures::Geometry.new
|
9
|
+
@geo.class.should eql(Geometry)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should instantiate from SimpleFeatures for compatibility" do
|
13
|
+
@geo = GeoRuby::SimpleFeatures::Geometry.new
|
14
|
+
@geo.class.should eql(Geometry)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should instantiate Point" do
|
18
|
+
@point = Point.new
|
19
|
+
@point.should be_instance_of(Point)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should instantiate Line" do
|
23
|
+
@line = LineString.new
|
24
|
+
@line.should be_instance_of(LineString)
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
# Must require active_spport/core_ext/object and then json/pure
|
4
|
+
# or the json module gets clobbered and geojson output
|
5
|
+
# becomes invalid... ie. it never calls class specific to_json
|
6
|
+
#require 'active_support/core_ext/object'
|
7
|
+
#require 'json/pure'
|
8
|
+
|
9
|
+
# begin
|
10
|
+
# require 'spec'
|
11
|
+
# rescue LoadError
|
12
|
+
require 'rspec'
|
13
|
+
#end
|
14
|
+
|
15
|
+
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
16
|
+
require 'geo_ruby'
|
17
|
+
require 'geo_ruby/shp'
|
18
|
+
require 'geo_ruby/gpx'
|
19
|
+
require 'geo_ruby/geojson'
|
20
|
+
require 'geo_ruby/georss'
|
21
|
+
|
22
|
+
include GeoRuby
|
23
|
+
include SimpleFeatures
|
24
|
+
|
25
|
+
module GeorubyMatchers
|
26
|
+
|
27
|
+
class BeGeometric
|
28
|
+
|
29
|
+
def matches?(actual)
|
30
|
+
actual.ancestors.include?(actual) || actual.kind_of?("Geometry")
|
31
|
+
end
|
32
|
+
|
33
|
+
def failure_message; "expected #{@actual.inspect} to be some geom"; end
|
34
|
+
end
|
35
|
+
|
36
|
+
class BeAPoint
|
37
|
+
include RSpec::Matchers
|
38
|
+
|
39
|
+
def initialize(expect=nil)
|
40
|
+
@expect = expect
|
41
|
+
end
|
42
|
+
|
43
|
+
def matches?(actual)
|
44
|
+
if @expect
|
45
|
+
[:x, :y, :z, :m].each_with_index do |c, i|
|
46
|
+
next unless val = @expect[i]
|
47
|
+
if val.kind_of? Numeric
|
48
|
+
actual.send(c).should be_within(0.1).of(val)
|
49
|
+
else
|
50
|
+
actual.send(c).should eql(val)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
actual.should be_instance_of(Point)
|
55
|
+
end
|
56
|
+
|
57
|
+
def failure_message; "expected #{@expect} but received #{@actual.inspect}"; end
|
58
|
+
def negative_failure_message; "expected something else then '#{@expect}' but got '#{@actual}'"; end
|
59
|
+
end
|
60
|
+
|
61
|
+
def be_a_point(*args)
|
62
|
+
args.empty? ? BeAPoint.new : BeAPoint.new(args)
|
63
|
+
end
|
64
|
+
|
65
|
+
def be_geometric
|
66
|
+
BeGeometric.new
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
RSpec.configure do |config|
|
71
|
+
config.include GeorubyMatchers
|
72
|
+
end
|
73
|
+
|
metadata
ADDED
@@ -0,0 +1,228 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: georuby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 9
|
8
|
+
- 3
|
9
|
+
version: 1.9.3
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Guilhem Vellut
|
13
|
+
- Marcos Piccinini
|
14
|
+
- Marcus Mateus
|
15
|
+
- Doug Cole
|
16
|
+
autorequire:
|
17
|
+
bindir: bin
|
18
|
+
cert_chain: []
|
19
|
+
|
20
|
+
date: 2011-06-30 00:00:00 -03:00
|
21
|
+
default_executable:
|
22
|
+
dependencies:
|
23
|
+
- !ruby/object:Gem::Dependency
|
24
|
+
name: dbf
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 5
|
33
|
+
- 0
|
34
|
+
version: 1.5.0
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: *id001
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: rspec
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
segments:
|
46
|
+
- 2
|
47
|
+
- 3
|
48
|
+
- 0
|
49
|
+
version: 2.3.0
|
50
|
+
type: :development
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: *id002
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: bundler
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
segments:
|
61
|
+
- 1
|
62
|
+
- 0
|
63
|
+
- 0
|
64
|
+
version: 1.0.0
|
65
|
+
type: :development
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: *id003
|
68
|
+
- !ruby/object:Gem::Dependency
|
69
|
+
name: rcov
|
70
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
segments:
|
76
|
+
- 0
|
77
|
+
version: "0"
|
78
|
+
type: :development
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: *id004
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: rspec
|
83
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
segments:
|
89
|
+
- 2
|
90
|
+
- 0
|
91
|
+
- 0
|
92
|
+
version: 2.0.0
|
93
|
+
type: :development
|
94
|
+
prerelease: false
|
95
|
+
version_requirements: *id005
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: dbf
|
98
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
segments:
|
104
|
+
- 1
|
105
|
+
- 2
|
106
|
+
- 9
|
107
|
+
version: 1.2.9
|
108
|
+
type: :development
|
109
|
+
prerelease: false
|
110
|
+
version_requirements: *id006
|
111
|
+
description: GeoRuby provides geometric data types from the OGC 'Simple Features' specification.
|
112
|
+
email: georuby@simplitex.com
|
113
|
+
executables: []
|
114
|
+
|
115
|
+
extensions: []
|
116
|
+
|
117
|
+
extra_rdoc_files:
|
118
|
+
- LICENSE
|
119
|
+
- README.rdoc
|
120
|
+
files:
|
121
|
+
- Gemfile
|
122
|
+
- Gemfile.lock
|
123
|
+
- History.txt
|
124
|
+
- LICENSE
|
125
|
+
- README.rdoc
|
126
|
+
- Rakefile
|
127
|
+
- VERSION
|
128
|
+
- georuby.gemspec
|
129
|
+
- lib/geo_ruby.rb
|
130
|
+
- lib/geo_ruby/geojson.rb
|
131
|
+
- lib/geo_ruby/georss.rb
|
132
|
+
- lib/geo_ruby/gpx.rb
|
133
|
+
- lib/geo_ruby/gpx4r/gpx.rb
|
134
|
+
- lib/geo_ruby/shp.rb
|
135
|
+
- lib/geo_ruby/shp4r/dbf.rb
|
136
|
+
- lib/geo_ruby/shp4r/shp.rb
|
137
|
+
- lib/geo_ruby/simple_features/envelope.rb
|
138
|
+
- lib/geo_ruby/simple_features/ewkb_parser.rb
|
139
|
+
- lib/geo_ruby/simple_features/ewkt_parser.rb
|
140
|
+
- lib/geo_ruby/simple_features/geometry.rb
|
141
|
+
- lib/geo_ruby/simple_features/geometry_collection.rb
|
142
|
+
- lib/geo_ruby/simple_features/geometry_factory.rb
|
143
|
+
- lib/geo_ruby/simple_features/helper.rb
|
144
|
+
- lib/geo_ruby/simple_features/line_string.rb
|
145
|
+
- lib/geo_ruby/simple_features/linear_ring.rb
|
146
|
+
- lib/geo_ruby/simple_features/multi_line_string.rb
|
147
|
+
- lib/geo_ruby/simple_features/multi_point.rb
|
148
|
+
- lib/geo_ruby/simple_features/multi_polygon.rb
|
149
|
+
- lib/geo_ruby/simple_features/point.rb
|
150
|
+
- lib/geo_ruby/simple_features/polygon.rb
|
151
|
+
- nofxx-georuby.gemspec
|
152
|
+
- spec/data/geojson/feature_collection.json
|
153
|
+
- spec/data/georss/atom.xml
|
154
|
+
- spec/data/georss/gml.xml
|
155
|
+
- spec/data/georss/w3c.xml
|
156
|
+
- spec/data/gpx/fells_loop.gpx
|
157
|
+
- spec/data/gpx/long.gpx
|
158
|
+
- spec/data/gpx/long.kml
|
159
|
+
- spec/data/gpx/long.nmea
|
160
|
+
- spec/data/gpx/short.gpx
|
161
|
+
- spec/data/gpx/short.kml
|
162
|
+
- spec/data/gpx/tracktreks.gpx
|
163
|
+
- spec/data/multipoint.dbf
|
164
|
+
- spec/data/multipoint.shp
|
165
|
+
- spec/data/multipoint.shx
|
166
|
+
- spec/data/point.dbf
|
167
|
+
- spec/data/point.shp
|
168
|
+
- spec/data/point.shx
|
169
|
+
- spec/data/polygon.dbf
|
170
|
+
- spec/data/polygon.shp
|
171
|
+
- spec/data/polygon.shx
|
172
|
+
- spec/data/polyline.dbf
|
173
|
+
- spec/data/polyline.shp
|
174
|
+
- spec/data/polyline.shx
|
175
|
+
- spec/geo_ruby/geojson_spec.rb
|
176
|
+
- spec/geo_ruby/georss.rb
|
177
|
+
- spec/geo_ruby/georss_spec.rb
|
178
|
+
- spec/geo_ruby/gpx4r/gpx_spec.rb
|
179
|
+
- spec/geo_ruby/shp4r/shp_spec.rb
|
180
|
+
- spec/geo_ruby/simple_features/envelope_spec.rb
|
181
|
+
- spec/geo_ruby/simple_features/ewkb_parser_spec.rb
|
182
|
+
- spec/geo_ruby/simple_features/ewkt_parser_spec.rb
|
183
|
+
- spec/geo_ruby/simple_features/geometry_collection_spec.rb
|
184
|
+
- spec/geo_ruby/simple_features/geometry_factory_spec.rb
|
185
|
+
- spec/geo_ruby/simple_features/geometry_spec.rb
|
186
|
+
- spec/geo_ruby/simple_features/line_string_spec.rb
|
187
|
+
- spec/geo_ruby/simple_features/linear_ring_spec.rb
|
188
|
+
- spec/geo_ruby/simple_features/multi_line_string_spec.rb
|
189
|
+
- spec/geo_ruby/simple_features/multi_point_spec.rb
|
190
|
+
- spec/geo_ruby/simple_features/multi_polygon_spec.rb
|
191
|
+
- spec/geo_ruby/simple_features/point_spec.rb
|
192
|
+
- spec/geo_ruby/simple_features/polygon_spec.rb
|
193
|
+
- spec/geo_ruby_spec.rb
|
194
|
+
- spec/spec_helper.rb
|
195
|
+
has_rdoc: true
|
196
|
+
homepage: http://github.com/nofxx/georuby
|
197
|
+
licenses: []
|
198
|
+
|
199
|
+
post_install_message:
|
200
|
+
rdoc_options: []
|
201
|
+
|
202
|
+
require_paths:
|
203
|
+
- lib
|
204
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
205
|
+
none: false
|
206
|
+
requirements:
|
207
|
+
- - ">="
|
208
|
+
- !ruby/object:Gem::Version
|
209
|
+
segments:
|
210
|
+
- 0
|
211
|
+
version: "0"
|
212
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
213
|
+
none: false
|
214
|
+
requirements:
|
215
|
+
- - ">="
|
216
|
+
- !ruby/object:Gem::Version
|
217
|
+
segments:
|
218
|
+
- 0
|
219
|
+
version: "0"
|
220
|
+
requirements: []
|
221
|
+
|
222
|
+
rubyforge_project:
|
223
|
+
rubygems_version: 1.3.7
|
224
|
+
signing_key:
|
225
|
+
specification_version: 3
|
226
|
+
summary: Ruby data holder for OGC Simple Features
|
227
|
+
test_files: []
|
228
|
+
|