rgeo 0.2.8 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +11 -3
- data/Spatial_Programming_With_RGeo.rdoc +8 -8
- data/Version +1 -1
- data/ext/geos_c_impl/factory.c +20 -3
- data/ext/geos_c_impl/factory.h +2 -0
- data/ext/geos_c_impl/geometry.c +31 -19
- data/lib/rgeo/cartesian/factory.rb +32 -3
- data/lib/rgeo/cartesian/interface.rb +22 -2
- data/lib/rgeo/feature/factory.rb +1 -1
- data/lib/rgeo/feature/factory_generator.rb +1 -1
- data/lib/rgeo/feature/types.rb +3 -3
- data/lib/rgeo/geographic/factory.rb +31 -2
- data/lib/rgeo/geographic/interface.rb +68 -5
- data/lib/rgeo/geographic/proj4_projector.rb +8 -1
- data/lib/rgeo/geos.rb +1 -1
- data/lib/rgeo/geos/factory.rb +69 -4
- data/lib/rgeo/geos/impl_additions.rb +1 -1
- data/lib/rgeo/geos/interface.rb +31 -0
- data/lib/rgeo/geos/zm_factory.rb +33 -2
- data/lib/rgeo/geos/zm_impl.rb +3 -3
- data/lib/rgeo/impl_helper/basic_geometry_methods.rb +2 -2
- data/lib/rgeo/wkrep/wkb_generator.rb +1 -24
- data/lib/rgeo/wkrep/wkb_parser.rb +32 -43
- data/lib/rgeo/wkrep/wkt_generator.rb +21 -43
- data/lib/rgeo/wkrep/wkt_parser.rb +10 -41
- data/test/common/point_tests.rb +7 -1
- data/test/geos/tc_parsing_unparsing.rb +80 -0
- data/test/wkrep/tc_wkb_parser.rb +44 -37
- data/test/wkrep/tc_wkt_generator.rb +25 -25
- data/test/wkrep/tc_wkt_parser.rb +1 -3
- metadata +4 -2
@@ -56,119 +56,119 @@ module RGeo
|
|
56
56
|
def test_point_2d
|
57
57
|
generator_ = ::RGeo::WKRep::WKTGenerator.new
|
58
58
|
obj_ = @factory.point(1, 2)
|
59
|
-
assert_equal('Point(1.0 2.0)', generator_.generate(obj_))
|
59
|
+
assert_equal('Point (1.0 2.0)', generator_.generate(obj_))
|
60
60
|
end
|
61
61
|
|
62
62
|
|
63
63
|
def test_point_z
|
64
64
|
generator_ = ::RGeo::WKRep::WKTGenerator.new
|
65
65
|
obj_ = @factoryz.point(1, 2, 3)
|
66
|
-
assert_equal('Point(1.0 2.0 3.0)', generator_.generate(obj_))
|
66
|
+
assert_equal('Point (1.0 2.0 3.0)', generator_.generate(obj_))
|
67
67
|
end
|
68
68
|
|
69
69
|
|
70
70
|
def test_point_z_wkt11strict
|
71
71
|
generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :wkt11_strict)
|
72
72
|
obj_ = @factoryz.point(1, 2, 3)
|
73
|
-
assert_equal('Point(1.0 2.0)', generator_.generate(obj_))
|
73
|
+
assert_equal('Point (1.0 2.0)', generator_.generate(obj_))
|
74
74
|
end
|
75
75
|
|
76
76
|
|
77
77
|
def test_point_m
|
78
78
|
generator_ = ::RGeo::WKRep::WKTGenerator.new
|
79
79
|
obj_ = @factorym.point(1, 2, 3)
|
80
|
-
assert_equal('Point(1.0 2.0 3.0)', generator_.generate(obj_))
|
80
|
+
assert_equal('Point (1.0 2.0 3.0)', generator_.generate(obj_))
|
81
81
|
end
|
82
82
|
|
83
83
|
|
84
84
|
def test_point_zm
|
85
85
|
generator_ = ::RGeo::WKRep::WKTGenerator.new
|
86
86
|
obj_ = @factoryzm.point(1, 2, 3, 4)
|
87
|
-
assert_equal('Point(1.0 2.0 3.0 4.0)', generator_.generate(obj_))
|
87
|
+
assert_equal('Point (1.0 2.0 3.0 4.0)', generator_.generate(obj_))
|
88
88
|
end
|
89
89
|
|
90
90
|
|
91
91
|
def test_point_squarebrackets
|
92
92
|
generator_ = ::RGeo::WKRep::WKTGenerator.new(:square_brackets => true)
|
93
93
|
obj_ = @factory.point(1, 2)
|
94
|
-
assert_equal('Point[1.0 2.0]', generator_.generate(obj_))
|
94
|
+
assert_equal('Point [1.0 2.0]', generator_.generate(obj_))
|
95
95
|
end
|
96
96
|
|
97
97
|
|
98
98
|
def test_point_uppercase
|
99
99
|
generator_ = ::RGeo::WKRep::WKTGenerator.new(:convert_case => :upper)
|
100
100
|
obj_ = @factory.point(1, 2)
|
101
|
-
assert_equal('POINT(1.0 2.0)', generator_.generate(obj_))
|
101
|
+
assert_equal('POINT (1.0 2.0)', generator_.generate(obj_))
|
102
102
|
end
|
103
103
|
|
104
104
|
|
105
105
|
def test_point_lowercase
|
106
106
|
generator_ = ::RGeo::WKRep::WKTGenerator.new(:convert_case => :lower)
|
107
107
|
obj_ = @factory.point(1, 2)
|
108
|
-
assert_equal('point(1.0 2.0)', generator_.generate(obj_))
|
108
|
+
assert_equal('point (1.0 2.0)', generator_.generate(obj_))
|
109
109
|
end
|
110
110
|
|
111
111
|
|
112
112
|
def test_point_wkt12
|
113
113
|
generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :wkt12)
|
114
114
|
obj_ = @factory.point(1, 2)
|
115
|
-
assert_equal('Point(1.0 2.0)', generator_.generate(obj_))
|
115
|
+
assert_equal('Point (1.0 2.0)', generator_.generate(obj_))
|
116
116
|
end
|
117
117
|
|
118
118
|
|
119
119
|
def test_point_wkt12_z
|
120
120
|
generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :wkt12)
|
121
121
|
obj_ = @factoryz.point(1, 2, 3)
|
122
|
-
assert_equal('Point Z(1.0 2.0 3.0)', generator_.generate(obj_))
|
122
|
+
assert_equal('Point Z (1.0 2.0 3.0)', generator_.generate(obj_))
|
123
123
|
end
|
124
124
|
|
125
125
|
|
126
126
|
def test_point_wkt12_m
|
127
127
|
generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :wkt12)
|
128
128
|
obj_ = @factorym.point(1, 2, 3)
|
129
|
-
assert_equal('Point M(1.0 2.0 3.0)', generator_.generate(obj_))
|
129
|
+
assert_equal('Point M (1.0 2.0 3.0)', generator_.generate(obj_))
|
130
130
|
end
|
131
131
|
|
132
132
|
|
133
133
|
def test_point_wkt12_zm
|
134
134
|
generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :wkt12)
|
135
135
|
obj_ = @factoryzm.point(1, 2, 3, 4)
|
136
|
-
assert_equal('Point ZM(1.0 2.0 3.0 4.0)', generator_.generate(obj_))
|
136
|
+
assert_equal('Point ZM (1.0 2.0 3.0 4.0)', generator_.generate(obj_))
|
137
137
|
end
|
138
138
|
|
139
139
|
|
140
140
|
def test_point_ewkt
|
141
141
|
generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :ewkt)
|
142
142
|
obj_ = @factory.point(1, 2)
|
143
|
-
assert_equal('Point(1.0 2.0)', generator_.generate(obj_))
|
143
|
+
assert_equal('Point (1.0 2.0)', generator_.generate(obj_))
|
144
144
|
end
|
145
145
|
|
146
146
|
|
147
147
|
def test_point_ewkt_z
|
148
148
|
generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :ewkt)
|
149
149
|
obj_ = @factoryz.point(1, 2, 3)
|
150
|
-
assert_equal('Point(1.0 2.0 3.0)', generator_.generate(obj_))
|
150
|
+
assert_equal('Point (1.0 2.0 3.0)', generator_.generate(obj_))
|
151
151
|
end
|
152
152
|
|
153
153
|
|
154
154
|
def test_point_ewkt_m
|
155
155
|
generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :ewkt)
|
156
156
|
obj_ = @factorym.point(1, 2, 3)
|
157
|
-
assert_equal('PointM(1.0 2.0 3.0)', generator_.generate(obj_))
|
157
|
+
assert_equal('PointM (1.0 2.0 3.0)', generator_.generate(obj_))
|
158
158
|
end
|
159
159
|
|
160
160
|
|
161
161
|
def test_point_ewkt_zm
|
162
162
|
generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :ewkt)
|
163
163
|
obj_ = @factoryzm.point(1, 2, 3, 4)
|
164
|
-
assert_equal('Point(1.0 2.0 3.0 4.0)', generator_.generate(obj_))
|
164
|
+
assert_equal('Point (1.0 2.0 3.0 4.0)', generator_.generate(obj_))
|
165
165
|
end
|
166
166
|
|
167
167
|
|
168
168
|
def test_point_ewkt_with_srid
|
169
169
|
generator_ = ::RGeo::WKRep::WKTGenerator.new(:tag_format => :ewkt, :emit_ewkt_srid => true)
|
170
170
|
obj_ = @factory.point(1, 2)
|
171
|
-
assert_equal('SRID=1000;Point(1.0 2.0)', generator_.generate(obj_))
|
171
|
+
assert_equal('SRID=1000;Point (1.0 2.0)', generator_.generate(obj_))
|
172
172
|
end
|
173
173
|
|
174
174
|
|
@@ -178,7 +178,7 @@ module RGeo
|
|
178
178
|
p2_ = @factory.point(2, 2)
|
179
179
|
p3_ = @factory.point(1, 1)
|
180
180
|
obj_ = @factory.line_string([p1_, p2_, p3_])
|
181
|
-
assert_equal('LineString(1.0 2.0,2.0 2.0,1.0 1.0)', generator_.generate(obj_))
|
181
|
+
assert_equal('LineString (1.0 2.0, 2.0 2.0, 1.0 1.0)', generator_.generate(obj_))
|
182
182
|
end
|
183
183
|
|
184
184
|
|
@@ -197,7 +197,7 @@ module RGeo
|
|
197
197
|
p4_ = @factory.point(0, 10)
|
198
198
|
ext_ = @factory.line_string([p1_, p2_, p3_, p4_, p1_])
|
199
199
|
obj_ = @factory.polygon(ext_)
|
200
|
-
assert_equal('Polygon((0.0 0.0,10.0 0.0,10.0 10.0,0.0 10.0,0.0 0.0))', generator_.generate(obj_))
|
200
|
+
assert_equal('Polygon ((0.0 0.0, 10.0 0.0, 10.0 10.0, 0.0 10.0, 0.0 0.0))', generator_.generate(obj_))
|
201
201
|
end
|
202
202
|
|
203
203
|
|
@@ -213,7 +213,7 @@ module RGeo
|
|
213
213
|
ext_ = @factory.line_string([p1_, p2_, p3_, p4_, p1_])
|
214
214
|
int_ = @factory.line_string([p5_, p6_, p7_, p5_])
|
215
215
|
obj_ = @factory.polygon(ext_, [int_])
|
216
|
-
assert_equal('Polygon((0.0 0.0,10.0 0.0,10.0 10.0,0.0 10.0,0.0 0.0),(1.0 1.0,2.0 2.0,3.0 1.0,1.0 1.0))', generator_.generate(obj_))
|
216
|
+
assert_equal('Polygon ((0.0 0.0, 10.0 0.0, 10.0 10.0, 0.0 10.0, 0.0 0.0), (1.0 1.0, 2.0 2.0, 3.0 1.0, 1.0 1.0))', generator_.generate(obj_))
|
217
217
|
end
|
218
218
|
|
219
219
|
|
@@ -230,7 +230,7 @@ module RGeo
|
|
230
230
|
p2_ = @factory.point(2, 2)
|
231
231
|
p3_ = @factory.point(1, 1)
|
232
232
|
obj_ = @factory.multi_point([p1_, p2_, p3_])
|
233
|
-
assert_equal('MultiPoint((1.0 2.0),(2.0 2.0),(1.0 1.0))', generator_.generate(obj_))
|
233
|
+
assert_equal('MultiPoint ((1.0 2.0), (2.0 2.0), (1.0 1.0))', generator_.generate(obj_))
|
234
234
|
end
|
235
235
|
|
236
236
|
|
@@ -254,7 +254,7 @@ module RGeo
|
|
254
254
|
ls2_ = @factory.line_string([p5_, p6_, p7_])
|
255
255
|
ls3_ = @factory.line_string([])
|
256
256
|
obj_ = @factory.multi_line_string([ls1_, ls2_, ls3_])
|
257
|
-
assert_equal('MultiLineString((0.0 0.0,10.0 0.0,10.0 10.0,0.0 10.0,0.0 0.0),(1.0 1.0,2.0 2.0,3.0 1.0),EMPTY)', generator_.generate(obj_))
|
257
|
+
assert_equal('MultiLineString ((0.0 0.0, 10.0 0.0, 10.0 10.0, 0.0 10.0, 0.0 0.0), (1.0 1.0, 2.0 2.0, 3.0 1.0), EMPTY)', generator_.generate(obj_))
|
258
258
|
end
|
259
259
|
|
260
260
|
|
@@ -285,7 +285,7 @@ module RGeo
|
|
285
285
|
poly2_ = @factory.polygon(@factory.line_string([]))
|
286
286
|
poly3_ = @factory.polygon(ext3_)
|
287
287
|
obj_ = @factory.multi_polygon([poly1_, poly2_, poly3_])
|
288
|
-
assert_equal('MultiPolygon(((0.0 0.0,10.0 0.0,10.0 10.0,0.0 10.0,0.0 0.0),(1.0 1.0,2.0 2.0,3.0 1.0,1.0 1.0)),EMPTY,((20.0 20.0,30.0 20.0,30.0 30.0,20.0 30.0,20.0 20.0)))', generator_.generate(obj_))
|
288
|
+
assert_equal('MultiPolygon (((0.0 0.0, 10.0 0.0, 10.0 10.0, 0.0 10.0, 0.0 0.0), (1.0 1.0, 2.0 2.0, 3.0 1.0, 1.0 1.0)), EMPTY, ((20.0 20.0, 30.0 20.0, 30.0 30.0, 20.0 30.0, 20.0 20.0)))', generator_.generate(obj_))
|
289
289
|
end
|
290
290
|
|
291
291
|
|
@@ -318,7 +318,7 @@ module RGeo
|
|
318
318
|
obj1_ = @factory.multi_polygon([poly1_, poly2_, poly3_])
|
319
319
|
obj2_ = @factory.point(1, 2)
|
320
320
|
obj_ = @factory.collection([obj1_, obj2_])
|
321
|
-
assert_equal('GeometryCollection(MultiPolygon(((0.0 0.0,10.0 0.0,10.0 10.0,0.0 10.0,0.0 0.0),(1.0 1.0,2.0 2.0,3.0 1.0,1.0 1.0)),EMPTY,((20.0 20.0,30.0 20.0,30.0 30.0,20.0 30.0,20.0 20.0))),Point(1.0 2.0))', generator_.generate(obj_))
|
321
|
+
assert_equal('GeometryCollection (MultiPolygon (((0.0 0.0, 10.0 0.0, 10.0 10.0, 0.0 10.0, 0.0 0.0), (1.0 1.0, 2.0 2.0, 3.0 1.0, 1.0 1.0)), EMPTY, ((20.0 20.0, 30.0 20.0, 30.0 30.0, 20.0 30.0, 20.0 20.0))), Point (1.0 2.0))', generator_.generate(obj_))
|
322
322
|
end
|
323
323
|
|
324
324
|
|
@@ -344,7 +344,7 @@ module RGeo
|
|
344
344
|
obj1_ = @factoryz.multi_polygon([poly1_, poly2_, poly3_])
|
345
345
|
obj2_ = @factoryz.point(1, 2, 3)
|
346
346
|
obj_ = @factoryz.collection([obj1_, obj2_])
|
347
|
-
assert_equal('GeometryCollection Z(MultiPolygon Z(((0.0 0.0 0.0,10.0 0.0 0.0,10.0 10.0 0.0,0.0 10.0 0.0,0.0 0.0 0.0),(1.0 1.0 0.0,2.0 2.0 0.0,3.0 1.0 0.0,1.0 1.0 0.0)),EMPTY,((20.0 20.0 0.0,30.0 20.0 0.0,30.0 30.0 0.0,20.0 30.0 0.0,20.0 20.0 0.0))),Point Z(1.0 2.0 3.0))', generator_.generate(obj_))
|
347
|
+
assert_equal('GeometryCollection Z (MultiPolygon Z (((0.0 0.0 0.0, 10.0 0.0 0.0, 10.0 10.0 0.0, 0.0 10.0 0.0, 0.0 0.0 0.0), (1.0 1.0 0.0, 2.0 2.0 0.0, 3.0 1.0 0.0, 1.0 1.0 0.0)), EMPTY, ((20.0 20.0 0.0, 30.0 20.0 0.0, 30.0 30.0 0.0, 20.0 30.0 0.0, 20.0 20.0 0.0))), Point Z (1.0 2.0 3.0))', generator_.generate(obj_))
|
348
348
|
end
|
349
349
|
|
350
350
|
|
data/test/wkrep/tc_wkt_parser.rb
CHANGED
@@ -245,9 +245,7 @@ module RGeo
|
|
245
245
|
|
246
246
|
|
247
247
|
def test_point_non_ewkt_with_srid
|
248
|
-
|
249
|
-
parser_ = ::RGeo::WKRep::WKTParser.new(factory_)
|
250
|
-
parser_.factory_generator = ::RGeo::Cartesian.method(:preferred_factory)
|
248
|
+
parser_ = ::RGeo::WKRep::WKTParser.new(::RGeo::Cartesian.method(:preferred_factory))
|
251
249
|
assert_raise(::RGeo::Error::ParseError) do
|
252
250
|
obj_ = parser_.parse('SRID=1000;POINT(1 2)')
|
253
251
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: rgeo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.9
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Daniel Azuma
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-04-
|
13
|
+
date: 2011-04-25 00:00:00 Z
|
14
14
|
dependencies: []
|
15
15
|
|
16
16
|
description: RGeo is a geospatial data library for Ruby. It provides an implementation of the Open Geospatial Consortium's Simple Features Specification, used by most standard spatial/geographic data storage systems such as PostGIS. A number of add-on modules are also available to help with writing location-based applications using Ruby-based frameworks such as Ruby On Rails.
|
@@ -130,6 +130,7 @@ files:
|
|
130
130
|
- test/geos/tc_multi_line_string.rb
|
131
131
|
- test/geos/tc_multi_point.rb
|
132
132
|
- test/geos/tc_multi_polygon.rb
|
133
|
+
- test/geos/tc_parsing_unparsing.rb
|
133
134
|
- test/geos/tc_point.rb
|
134
135
|
- test/geos/tc_polygon.rb
|
135
136
|
- test/geos/tc_zmfactory.rb
|
@@ -215,6 +216,7 @@ test_files:
|
|
215
216
|
- test/geos/tc_multi_line_string.rb
|
216
217
|
- test/geos/tc_multi_point.rb
|
217
218
|
- test/geos/tc_multi_polygon.rb
|
219
|
+
- test/geos/tc_parsing_unparsing.rb
|
218
220
|
- test/geos/tc_point.rb
|
219
221
|
- test/geos/tc_polygon.rb
|
220
222
|
- test/geos/tc_zmfactory.rb
|