rgeo 0.1.15 → 0.1.16
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +9 -0
- data/README.rdoc +1 -0
- data/Version +1 -1
- data/lib/rgeo/cartesian/factory.rb +2 -2
- data/lib/rgeo/features/factory.rb +6 -5
- data/lib/rgeo/features/types.rb +23 -3
- data/lib/rgeo/geo_json/coder.rb +85 -24
- data/lib/rgeo/geo_json/entities.rb +6 -5
- data/lib/rgeo/geo_json/interface.rb +51 -17
- data/lib/rgeo/wkrep/wkb_generator.rb +1 -1
- data/tests/tc_geojson.rb +61 -12
- data/tests/wkrep/tc_wkb_generator.rb +249 -0
- data/tests/wkrep/tc_wkb_parser.rb +353 -0
- metadata +9 -19
data/History.rdoc
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
=== 0.1.16 / 2010-11-18
|
2
|
+
|
3
|
+
* Test coverage for WKB generator and parser; fixed a few bugs.
|
4
|
+
* Eliminated the hard dependency on the JSON gem, and allow configuration of GeoJSON with an alternate JSON parser such as YAJL or ActiveSupport.
|
5
|
+
* API CHANGE: geo factory is now a hash option in GeoJSON, and is now optional.
|
6
|
+
* GeoJSON now handles Z and M coordinates, according to the capabilities of the geo factory.
|
7
|
+
* GeoJSON feature objects can now handle null geometry and null properties, per the spec.
|
8
|
+
* Factory::cast now optionally lets you pass the parameters as a hash.
|
9
|
+
|
1
10
|
=== 0.1.15 / 2010-11-08
|
2
11
|
|
3
12
|
* Cleanup, fixes, documentation, and partial test coverage in the WKT/WKB implementations.
|
data/README.rdoc
CHANGED
@@ -76,6 +76,7 @@ yet complete. These include:
|
|
76
76
|
* Some operations on SimpleCartesian and SimpleSpherical.
|
77
77
|
* Rails (ActiveRecord or ActiveModel) integration.
|
78
78
|
* Other third-party integration, including possibly SimpleGeo.
|
79
|
+
* Support for bbox and crs elements of GeoJSON.
|
79
80
|
* Support for additional formats such as ESRI shapefiles.
|
80
81
|
* JRuby support via JTS integration.
|
81
82
|
* Rubinius support for Geos integration.
|
data/Version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.16
|
@@ -90,14 +90,14 @@ module RGeo
|
|
90
90
|
# See ::RGeo::Features::Factory#parse_wkt
|
91
91
|
|
92
92
|
def parse_wkt(str_)
|
93
|
-
|
93
|
+
WKRep::WKTParser.new(:default_factory => self).parse(str_)
|
94
94
|
end
|
95
95
|
|
96
96
|
|
97
97
|
# See ::RGeo::Features::Factory#parse_wkb
|
98
98
|
|
99
99
|
def parse_wkb(str_)
|
100
|
-
|
100
|
+
WKRep::WKBParser.new(:default_factory => self).parse(str_)
|
101
101
|
end
|
102
102
|
|
103
103
|
|
@@ -44,13 +44,14 @@ module RGeo
|
|
44
44
|
# methods as a standard way to create features.
|
45
45
|
#
|
46
46
|
# If the implementation is unable to create the given feature,
|
47
|
-
# it should return nil.
|
47
|
+
# it should generally return nil. Implementations may also choose to
|
48
|
+
# raise an exception on failure.
|
48
49
|
#
|
49
50
|
# Some implementations may extend this interface to provide facilities
|
50
|
-
# for creating additional objects according to the
|
51
|
-
# by that implementation. Examples might include
|
52
|
-
# coordinates or additional subclasses not
|
53
|
-
# Simple Features Specification.
|
51
|
+
# for creating additional objects according to the capabilities
|
52
|
+
# provided by that implementation. Examples might include
|
53
|
+
# higher-dimensional coordinates or additional subclasses not
|
54
|
+
# explicitly required by the Simple Features Specification.
|
54
55
|
#
|
55
56
|
# Factory is defined as a module and is provided primarily for the
|
56
57
|
# sake of documentation. Implementations need not necessarily include
|
data/lib/rgeo/features/types.rb
CHANGED
@@ -101,13 +101,28 @@ module RGeo
|
|
101
101
|
|
102
102
|
# Cast the given object according to the given parameters.
|
103
103
|
#
|
104
|
-
# You may optionally pass a factory, a feature type,
|
105
|
-
# <tt>:force_new</tt
|
106
|
-
#
|
104
|
+
# You may optionally pass a factory, a feature type, the value
|
105
|
+
# <tt>:force_new</tt>, and the value <tt>:keep_subtype</tt> as the
|
106
|
+
# parameters. You may also pass the parameters as a hash, with the
|
107
|
+
# keys <tt>:factory</tt>, <tt>:type</tt>, <tt>:force_new</tt> and
|
108
|
+
# <tt>:keep_subtype</tt>.
|
109
|
+
#
|
110
|
+
# The given object will be casted into the given factory and
|
111
|
+
# feature type, if possible.
|
107
112
|
# If the cast is not possible to accomplish, nil is returned.
|
108
113
|
# If the factory or type is not provided, or is the same as the
|
109
114
|
# object's current attribute, that attribute is not modified.
|
110
115
|
#
|
116
|
+
# Normally, casting to a particular type always casts strictly to
|
117
|
+
# that type, even if the old type is a subtype of the new type.
|
118
|
+
# You can cause cast to retain the subtype by passing
|
119
|
+
# <tt>:keep_subtype</tt> as one of the parameters. For example,
|
120
|
+
# casting a LinearRing to a LineString will normally yield a
|
121
|
+
# LineString. However, if you specify <tt>:keep_subtype</tt>, the
|
122
|
+
# casted object will remain a LinearRing. You cannot cast to a
|
123
|
+
# non-instantiable type (such as Curve) without specifying
|
124
|
+
# <tt>:keep_subtype</tt>.
|
125
|
+
#
|
111
126
|
# Normally, if neither the factory nor the type are set to be
|
112
127
|
# modified, the original object is returned. However, you may cause
|
113
128
|
# cast to return a duplicate of the original object by passing
|
@@ -135,6 +150,11 @@ module RGeo
|
|
135
150
|
force_new_ = param_
|
136
151
|
when :keep_subtype
|
137
152
|
keep_subtype_ = param_
|
153
|
+
when ::Hash
|
154
|
+
nfactory_ = param_[:factory] || nfactory_
|
155
|
+
ntype_ = param_[:type] || ntype_
|
156
|
+
force_new_ = param_[:force_new] if param_.include?(:force_new)
|
157
|
+
keep_subtype_ = param_[:keep_subtype] if param_.include?(:keep_subtype)
|
138
158
|
end
|
139
159
|
end
|
140
160
|
|
data/lib/rgeo/geo_json/coder.rb
CHANGED
@@ -34,9 +34,6 @@
|
|
34
34
|
;
|
35
35
|
|
36
36
|
|
37
|
-
require 'json'
|
38
|
-
|
39
|
-
|
40
37
|
module RGeo
|
41
38
|
|
42
39
|
module GeoJSON
|
@@ -51,14 +48,62 @@ module RGeo
|
|
51
48
|
|
52
49
|
|
53
50
|
# Create a new coder settings object. The geo factory is passed as
|
54
|
-
# a required argument.
|
55
|
-
#
|
56
|
-
#
|
57
|
-
#
|
58
|
-
|
59
|
-
|
60
|
-
|
51
|
+
# a required argument.
|
52
|
+
#
|
53
|
+
# Options include:
|
54
|
+
#
|
55
|
+
# <tt>:geo_factory</tt>::
|
56
|
+
# Specifies the geo factory to use to create geometry objects.
|
57
|
+
# Defaults to the preferred cartesian factory.
|
58
|
+
# <tt>:entity_factory</tt>::
|
59
|
+
# Specifies an entity factory, which lets you override the types
|
60
|
+
# of GeoJSON entities that are created. It defaults to the default
|
61
|
+
# RGeo::GeoJSON::EntityFactory, which generates objects of type
|
62
|
+
# RGeo::GeoJSON::Feature or RGeo::GeoJSON::FeatureCollection.
|
63
|
+
# See RGeo::GeoJSON::EntityFactory for more information.
|
64
|
+
# <tt>:json_parser</tt>::
|
65
|
+
# Specifies a JSON parser to use when decoding a String or IO
|
66
|
+
# object. The value may be a Proc object taking the string as the
|
67
|
+
# sole argument and returning the JSON hash, or it may be one of
|
68
|
+
# the special values <tt>:json</tt>, <tt>:yajl</tt>, or
|
69
|
+
# <tt>:active_support</tt>. Setting one of those special values
|
70
|
+
# will require the corresponding library to be available. The
|
71
|
+
# default is <tt>:json</tt>, which is present in the standard
|
72
|
+
# library in Ruby 1.9, but requires the "json" gem in Ruby 1.8.
|
73
|
+
# If the specified parser is not available, then decode will not
|
74
|
+
# accept a String or IO object; it will require a Hash.
|
75
|
+
|
76
|
+
def initialize(opts_={})
|
77
|
+
@geo_factory = opts_[:geo_factory] || ::RGeo::Cartesian.preferred_factory
|
61
78
|
@entity_factory = opts_[:entity_factory] || EntityFactory.instance
|
79
|
+
@json_parser = opts_[:json_parser] || :json
|
80
|
+
case @json_parser
|
81
|
+
when :json
|
82
|
+
begin
|
83
|
+
require 'json'
|
84
|
+
@json_parser = ::Proc.new{ |str_| ::JSON.parse(str_) }
|
85
|
+
rescue ::LoadError
|
86
|
+
end
|
87
|
+
when :yajl
|
88
|
+
begin
|
89
|
+
require 'yajl'
|
90
|
+
@json_parser = ::Proc.new{ |str_| ::Yajl::Parser.new.parse(str_) }
|
91
|
+
rescue ::LoadError
|
92
|
+
end
|
93
|
+
when :active_support
|
94
|
+
begin
|
95
|
+
require 'active_support/json'
|
96
|
+
@json_parser = ::Proc.new{ |str_| ::ActiveSupport::JSON.decode(str_) }
|
97
|
+
rescue ::LoadError
|
98
|
+
end
|
99
|
+
when ::Proc
|
100
|
+
# Leave as is
|
101
|
+
else
|
102
|
+
raise ::ArgumentError, "Unrecognzied json_parser: #{@json_parser.inspect}"
|
103
|
+
end
|
104
|
+
@num_coordinates = 2
|
105
|
+
@num_coordinates += 1 if @geo_factory.has_capability?(:z_coordinate)
|
106
|
+
@num_coordinates += 1 if @geo_factory.has_capability?(:m_coordinate)
|
62
107
|
end
|
63
108
|
|
64
109
|
|
@@ -82,13 +127,14 @@ module RGeo
|
|
82
127
|
|
83
128
|
# Decode an object from GeoJSON. The input may be a JSON hash, a
|
84
129
|
# String, or an IO object from which to read the JSON string.
|
130
|
+
# If an error occurs, nil is returned.
|
85
131
|
|
86
132
|
def decode(input_)
|
87
133
|
if input_.kind_of?(::IO)
|
88
134
|
input_ = input_.read rescue nil
|
89
135
|
end
|
90
136
|
if input_.kind_of?(::String)
|
91
|
-
input_ =
|
137
|
+
input_ = @json_parser.call(input_) rescue nil
|
92
138
|
end
|
93
139
|
unless input_.kind_of?(::Hash)
|
94
140
|
return nil
|
@@ -139,42 +185,57 @@ module RGeo
|
|
139
185
|
end
|
140
186
|
|
141
187
|
|
142
|
-
def _encode_geometry(object_) # :nodoc:
|
188
|
+
def _encode_geometry(object_, point_encoder_=nil) # :nodoc:
|
189
|
+
unless point_encoder_
|
190
|
+
if object_.factory.has_capability?(:z_coordinate)
|
191
|
+
if object_.factory.has_capability?(:m_coordinate)
|
192
|
+
point_encoder_ = ::Proc.new{ |p_| [p_.x, p_.y, p_.z, p_.m] }
|
193
|
+
else
|
194
|
+
point_encoder_ = ::Proc.new{ |p_| [p_.x, p_.y, p_.z] }
|
195
|
+
end
|
196
|
+
else
|
197
|
+
if object_.factory.has_capability?(:m_coordinate)
|
198
|
+
point_encoder_ = ::Proc.new{ |p_| [p_.x, p_.y, p_.m] }
|
199
|
+
else
|
200
|
+
point_encoder_ = ::Proc.new{ |p_| [p_.x, p_.y] }
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
143
204
|
case object_
|
144
205
|
when Features::Point
|
145
206
|
{
|
146
207
|
'type' => 'Point',
|
147
|
-
'coordinates' =>
|
208
|
+
'coordinates' => point_encoder_.call(object_),
|
148
209
|
}
|
149
210
|
when Features::LineString
|
150
211
|
{
|
151
212
|
'type' => 'LineString',
|
152
|
-
'coordinates' => object_.points.map
|
213
|
+
'coordinates' => object_.points.map(&point_encoder_),
|
153
214
|
}
|
154
215
|
when Features::Polygon
|
155
216
|
{
|
156
217
|
'type' => 'Polygon',
|
157
|
-
'coordinates' => [object_.exterior_ring.points.map
|
218
|
+
'coordinates' => [object_.exterior_ring.points.map(&point_encoder_)] + object_.interior_rings.map{ |r_| r_.points.map(&point_encoder_) }
|
158
219
|
}
|
159
220
|
when Features::MultiPoint
|
160
221
|
{
|
161
222
|
'type' => 'MultiPoint',
|
162
|
-
'coordinates' => object_.map
|
223
|
+
'coordinates' => object_.map(&point_encoder_),
|
163
224
|
}
|
164
225
|
when Features::MultiLineString
|
165
226
|
{
|
166
227
|
'type' => 'MultiLineString',
|
167
|
-
'coordinates' => object_.map{ |ls_| ls_.points.map
|
228
|
+
'coordinates' => object_.map{ |ls_| ls_.points.map(&point_encoder_) },
|
168
229
|
}
|
169
230
|
when Features::MultiPolygon
|
170
231
|
{
|
171
232
|
'type' => 'MultiPolygon',
|
172
|
-
'coordinates' => object_.map{ |poly_| [poly_.exterior_ring.points.map
|
233
|
+
'coordinates' => object_.map{ |poly_| [poly_.exterior_ring.points.map(&point_encoder_)] + poly_.interior_rings.map{ |r_| r_.points.map(&point_encoder_) } },
|
173
234
|
}
|
174
235
|
when Features::GeometryCollection
|
175
236
|
{
|
176
237
|
'type' => 'GeometryCollection',
|
177
|
-
'geometries' => object_.map{ |geom_| _encode_geometry(geom_) },
|
238
|
+
'geometries' => object_.map{ |geom_| _encode_geometry(geom_, point_encoder_) },
|
178
239
|
}
|
179
240
|
else
|
180
241
|
nil
|
@@ -183,12 +244,12 @@ module RGeo
|
|
183
244
|
|
184
245
|
|
185
246
|
def _decode_feature(input_) # :nodoc:
|
186
|
-
geometry_ =
|
247
|
+
geometry_ = input_['geometry']
|
187
248
|
if geometry_
|
188
|
-
|
189
|
-
|
190
|
-
nil
|
249
|
+
geometry_ = _decode_geometry(geometry_)
|
250
|
+
return nil unless geometry_
|
191
251
|
end
|
252
|
+
@entity_factory.feature(geometry_, input_['id'], input_['properties'])
|
192
253
|
end
|
193
254
|
|
194
255
|
|
@@ -228,7 +289,7 @@ module RGeo
|
|
228
289
|
|
229
290
|
def _decode_point_coords(point_coords_) # :nodoc:
|
230
291
|
return nil unless point_coords_.kind_of?(::Array)
|
231
|
-
@geo_factory.point(point_coords_[0].
|
292
|
+
@geo_factory.point(*(point_coords_[0...@num_coordinates].map{ |c_| c_.to_f })) rescue nil
|
232
293
|
end
|
233
294
|
|
234
295
|
|
@@ -63,7 +63,7 @@ module RGeo
|
|
63
63
|
|
64
64
|
|
65
65
|
def inspect # :nodoc:
|
66
|
-
"#<#{self.class}:0x#{object_id.to_s(16)} id=#{@id.inspect} geom=#{@geometry.as_text.inspect}>"
|
66
|
+
"#<#{self.class}:0x#{object_id.to_s(16)} id=#{@id.inspect} geom=#{@geometry ? @geometry.as_text.inspect : 'nil'}>"
|
67
67
|
end
|
68
68
|
|
69
69
|
def to_s # :nodoc:
|
@@ -95,7 +95,7 @@ module RGeo
|
|
95
95
|
end
|
96
96
|
|
97
97
|
|
98
|
-
# Returns the geometry contained in this feature.
|
98
|
+
# Returns the geometry contained in this feature, which may be nil.
|
99
99
|
|
100
100
|
def geometry
|
101
101
|
@geometry
|
@@ -208,10 +208,11 @@ module RGeo
|
|
208
208
|
|
209
209
|
|
210
210
|
# Create and return a new feature, given geometry, ID, and
|
211
|
-
# properties hash.
|
211
|
+
# properties hash. Note that, per the GeoJSON spec, geometry and/or
|
212
|
+
# properties may be nil.
|
212
213
|
|
213
|
-
def feature(geometry_, id_=nil, properties_=
|
214
|
-
Feature.new(geometry_, id_, properties_)
|
214
|
+
def feature(geometry_, id_=nil, properties_=nil)
|
215
|
+
Feature.new(geometry_, id_, properties_ || {})
|
215
216
|
end
|
216
217
|
|
217
218
|
|
@@ -53,23 +53,39 @@ module RGeo
|
|
53
53
|
# RGeo::GeoJSON::FeatureCollection.
|
54
54
|
|
55
55
|
def encode(object_, opts_={})
|
56
|
-
Coder.new(
|
56
|
+
Coder.new(opts_).encode(object_)
|
57
57
|
end
|
58
58
|
|
59
59
|
|
60
60
|
# High-level convenience routine for decoding an object from GeoJSON.
|
61
61
|
# The input may be a JSON hash, a String, or an IO object from which
|
62
|
-
# to read the JSON string.
|
63
|
-
# RGeo::Features::Factory to use to create geometric objects.
|
62
|
+
# to read the JSON string.
|
64
63
|
#
|
65
|
-
#
|
66
|
-
#
|
67
|
-
#
|
68
|
-
#
|
69
|
-
#
|
64
|
+
# Options include:
|
65
|
+
#
|
66
|
+
# <tt>:geo_factory</tt>::
|
67
|
+
# Specifies the geo factory to use to create geometry objects.
|
68
|
+
# Defaults to the preferred cartesian factory.
|
69
|
+
# <tt>:entity_factory</tt>::
|
70
|
+
# Specifies an entity factory, which lets you override the types
|
71
|
+
# of GeoJSON entities that are created. It defaults to the default
|
72
|
+
# RGeo::GeoJSON::EntityFactory, which generates objects of type
|
73
|
+
# RGeo::GeoJSON::Feature or RGeo::GeoJSON::FeatureCollection.
|
74
|
+
# See RGeo::GeoJSON::EntityFactory for more information.
|
75
|
+
# <tt>:json_parser</tt>::
|
76
|
+
# Specifies a JSON parser to use when decoding a String or IO
|
77
|
+
# object. The value may be a Proc object taking the string as the
|
78
|
+
# sole argument and returning the JSON hash, or it may be one of
|
79
|
+
# the special values <tt>:json</tt>, <tt>:yajl</tt>, or
|
80
|
+
# <tt>:active_support</tt>. Setting one of those special values
|
81
|
+
# will require the corresponding library to be available. The
|
82
|
+
# default is <tt>:json</tt>, which is present in the standard
|
83
|
+
# library in Ruby 1.9, but requires the "json" gem in Ruby 1.8.
|
84
|
+
# If the specified parser is not available, then decode will not
|
85
|
+
# accept a String or IO object; it will require a Hash.
|
70
86
|
|
71
|
-
def decode(input_,
|
72
|
-
Coder.new(
|
87
|
+
def decode(input_, opts_={})
|
88
|
+
Coder.new(opts_).decode(input_)
|
73
89
|
end
|
74
90
|
|
75
91
|
|
@@ -77,14 +93,32 @@ module RGeo
|
|
77
93
|
# that encapsulates encoding and decoding settings (principally the
|
78
94
|
# RGeo::Features::Factory and the RGeo::GeoJSON::EntityFactory to be
|
79
95
|
# used).
|
80
|
-
#
|
81
|
-
#
|
82
|
-
#
|
83
|
-
#
|
84
|
-
#
|
96
|
+
#
|
97
|
+
# The geo factory is a required argument. Other options include:
|
98
|
+
#
|
99
|
+
# <tt>:geo_factory</tt>::
|
100
|
+
# Specifies the geo factory to use to create geometry objects.
|
101
|
+
# Defaults to the preferred cartesian factory.
|
102
|
+
# <tt>:entity_factory</tt>::
|
103
|
+
# Specifies an entity factory, which lets you override the types
|
104
|
+
# of GeoJSON entities that are created. It defaults to the default
|
105
|
+
# RGeo::GeoJSON::EntityFactory, which generates objects of type
|
106
|
+
# RGeo::GeoJSON::Feature or RGeo::GeoJSON::FeatureCollection.
|
107
|
+
# See RGeo::GeoJSON::EntityFactory for more information.
|
108
|
+
# <tt>:json_parser</tt>::
|
109
|
+
# Specifies a JSON parser to use when decoding a String or IO
|
110
|
+
# object. The value may be a Proc object taking the string as the
|
111
|
+
# sole argument and returning the JSON hash, or it may be one of
|
112
|
+
# the special values <tt>:json</tt>, <tt>:yajl</tt>, or
|
113
|
+
# <tt>:active_support</tt>. Setting one of those special values
|
114
|
+
# will require the corresponding library to be available. The
|
115
|
+
# default is <tt>:json</tt>, which is present in the standard
|
116
|
+
# library in Ruby 1.9, but requires the "json" gem in Ruby 1.8.
|
117
|
+
# If the specified parser is not available, then decode will not
|
118
|
+
# accept a String or IO object; it will require a Hash.
|
85
119
|
|
86
|
-
def coder(
|
87
|
-
Coder.new(
|
120
|
+
def coder(opts_={})
|
121
|
+
Coder.new(opts_)
|
88
122
|
end
|
89
123
|
|
90
124
|
|
@@ -177,7 +177,7 @@ module RGeo
|
|
177
177
|
type_code_ |= 0x80000000 if @cur_has_z
|
178
178
|
type_code_ |= 0x40000000 if @cur_has_m
|
179
179
|
if @emit_ewkb_srid && toplevel_
|
180
|
-
|
180
|
+
type_code_ |= 0x20000000
|
181
181
|
emit_srid_ = true
|
182
182
|
end
|
183
183
|
elsif @type_format == :wkb12
|
data/tests/tc_geojson.rb
CHANGED
@@ -45,7 +45,10 @@ module RGeo
|
|
45
45
|
|
46
46
|
|
47
47
|
def setup
|
48
|
-
@geo_factory = ::RGeo::
|
48
|
+
@geo_factory = ::RGeo::Cartesian.simple_factory(:srid => 4326)
|
49
|
+
@geo_factory_z = ::RGeo::Cartesian.simple_factory(:srid => 4326, :support_z_coordinate => true)
|
50
|
+
@geo_factory_m = ::RGeo::Cartesian.simple_factory(:srid => 4326, :support_m_coordinate => true)
|
51
|
+
@geo_factory_zm = ::RGeo::Cartesian.simple_factory(:srid => 4326, :support_z_coordinate => true, :support_m_coordinate => true)
|
49
52
|
@entity_factory = ::RGeo::GeoJSON::EntityFactory.instance
|
50
53
|
end
|
51
54
|
|
@@ -57,7 +60,40 @@ module RGeo
|
|
57
60
|
'coordinates' => [10.0, 20.0],
|
58
61
|
}
|
59
62
|
assert_equal(json_, ::RGeo::GeoJSON.encode(object_))
|
60
|
-
assert(::RGeo::GeoJSON.decode(json_, @geo_factory).eql?(object_))
|
63
|
+
assert(::RGeo::GeoJSON.decode(json_, :geo_factory => @geo_factory).eql?(object_))
|
64
|
+
end
|
65
|
+
|
66
|
+
|
67
|
+
def test_point_z
|
68
|
+
object_ = @geo_factory_z.point(10, 20, -1)
|
69
|
+
json_ = {
|
70
|
+
'type' => 'Point',
|
71
|
+
'coordinates' => [10.0, 20.0, -1.0],
|
72
|
+
}
|
73
|
+
assert_equal(json_, ::RGeo::GeoJSON.encode(object_))
|
74
|
+
assert(::RGeo::GeoJSON.decode(json_, :geo_factory => @geo_factory_z).eql?(object_))
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
def test_point_m
|
79
|
+
object_ = @geo_factory_m.point(10, 20, -1)
|
80
|
+
json_ = {
|
81
|
+
'type' => 'Point',
|
82
|
+
'coordinates' => [10.0, 20.0, -1.0],
|
83
|
+
}
|
84
|
+
assert_equal(json_, ::RGeo::GeoJSON.encode(object_))
|
85
|
+
assert(::RGeo::GeoJSON.decode(json_, :geo_factory => @geo_factory_m).eql?(object_))
|
86
|
+
end
|
87
|
+
|
88
|
+
|
89
|
+
def test_point_zm
|
90
|
+
object_ = @geo_factory_zm.point(10, 20, -1, -2)
|
91
|
+
json_ = {
|
92
|
+
'type' => 'Point',
|
93
|
+
'coordinates' => [10.0, 20.0, -1.0, -2.0],
|
94
|
+
}
|
95
|
+
assert_equal(json_, ::RGeo::GeoJSON.encode(object_))
|
96
|
+
assert(::RGeo::GeoJSON.decode(json_, :geo_factory => @geo_factory_zm).eql?(object_))
|
61
97
|
end
|
62
98
|
|
63
99
|
|
@@ -68,7 +104,7 @@ module RGeo
|
|
68
104
|
'coordinates' => [[10.0, 20.0], [12.0, 22.0], [-3.0, 24.0]],
|
69
105
|
}
|
70
106
|
assert_equal(json_, ::RGeo::GeoJSON.encode(object_))
|
71
|
-
assert(::RGeo::GeoJSON.decode(json_, @geo_factory).eql?(object_))
|
107
|
+
assert(::RGeo::GeoJSON.decode(json_, :geo_factory => @geo_factory).eql?(object_))
|
72
108
|
end
|
73
109
|
|
74
110
|
|
@@ -79,7 +115,7 @@ module RGeo
|
|
79
115
|
'coordinates' => [[[10.0, 20.0], [12.0, 22.0], [-3.0, 24.0], [10.0, 20.0]]],
|
80
116
|
}
|
81
117
|
assert_equal(json_, ::RGeo::GeoJSON.encode(object_))
|
82
|
-
assert(::RGeo::GeoJSON.decode(json_, @geo_factory).eql?(object_))
|
118
|
+
assert(::RGeo::GeoJSON.decode(json_, :geo_factory => @geo_factory).eql?(object_))
|
83
119
|
end
|
84
120
|
|
85
121
|
|
@@ -90,7 +126,7 @@ module RGeo
|
|
90
126
|
'coordinates' => [[[0.0, 0.0], [10.0, 0.0], [10.0, 10.0], [0.0, 10.0], [0.0, 0.0]], [[4.0, 4.0], [6.0, 5.0], [4.0, 6.0], [4.0, 4.0]]],
|
91
127
|
}
|
92
128
|
assert_equal(json_, ::RGeo::GeoJSON.encode(object_))
|
93
|
-
assert(::RGeo::GeoJSON.decode(json_, @geo_factory).eql?(object_))
|
129
|
+
assert(::RGeo::GeoJSON.decode(json_, :geo_factory => @geo_factory).eql?(object_))
|
94
130
|
end
|
95
131
|
|
96
132
|
|
@@ -101,7 +137,7 @@ module RGeo
|
|
101
137
|
'coordinates' => [[10.0, 20.0], [12.0, 22.0], [-3.0, 24.0]],
|
102
138
|
}
|
103
139
|
assert_equal(json_, ::RGeo::GeoJSON.encode(object_))
|
104
|
-
assert(::RGeo::GeoJSON.decode(json_, @geo_factory).eql?(object_))
|
140
|
+
assert(::RGeo::GeoJSON.decode(json_, :geo_factory => @geo_factory).eql?(object_))
|
105
141
|
end
|
106
142
|
|
107
143
|
|
@@ -112,7 +148,7 @@ module RGeo
|
|
112
148
|
'coordinates' => [[[10.0, 20.0], [12.0, 22.0], [-3.0, 24.0]], [[1.0, 2.0], [3.0, 4.0]]],
|
113
149
|
}
|
114
150
|
assert_equal(json_, ::RGeo::GeoJSON.encode(object_))
|
115
|
-
assert(::RGeo::GeoJSON.decode(json_, @geo_factory).eql?(object_))
|
151
|
+
assert(::RGeo::GeoJSON.decode(json_, :geo_factory => @geo_factory).eql?(object_))
|
116
152
|
end
|
117
153
|
|
118
154
|
|
@@ -123,7 +159,7 @@ module RGeo
|
|
123
159
|
'coordinates' => [[[[0.0, 0.0], [10.0, 0.0], [10.0, 10.0], [0.0, 10.0], [0.0, 0.0]], [[4.0, 4.0], [6.0, 5.0], [4.0, 6.0], [4.0, 4.0]]], [[[-10.0, -10.0], [-15.0, -10.0], [-10.0, -15.0], [-10.0, -10.0]]]]
|
124
160
|
}
|
125
161
|
assert_equal(json_, ::RGeo::GeoJSON.encode(object_))
|
126
|
-
assert(::RGeo::GeoJSON.decode(json_, @geo_factory).eql?(object_))
|
162
|
+
assert(::RGeo::GeoJSON.decode(json_, :geo_factory => @geo_factory).eql?(object_))
|
127
163
|
end
|
128
164
|
|
129
165
|
|
@@ -152,7 +188,7 @@ module RGeo
|
|
152
188
|
],
|
153
189
|
}
|
154
190
|
assert_equal(json_, ::RGeo::GeoJSON.encode(object_))
|
155
|
-
assert(::RGeo::GeoJSON.decode(json_, @geo_factory).eql?(object_))
|
191
|
+
assert(::RGeo::GeoJSON.decode(json_, :geo_factory => @geo_factory).eql?(object_))
|
156
192
|
end
|
157
193
|
|
158
194
|
|
@@ -167,7 +203,20 @@ module RGeo
|
|
167
203
|
'properties' => {},
|
168
204
|
}
|
169
205
|
assert_equal(json_, ::RGeo::GeoJSON.encode(object_))
|
170
|
-
assert(::RGeo::GeoJSON.decode(json_, @geo_factory).eql?(object_))
|
206
|
+
assert(::RGeo::GeoJSON.decode(json_, :geo_factory => @geo_factory).eql?(object_))
|
207
|
+
end
|
208
|
+
|
209
|
+
|
210
|
+
def test_feature_nulls
|
211
|
+
json_ = {
|
212
|
+
'type' => 'Feature',
|
213
|
+
'geometry' => nil,
|
214
|
+
'properties' => nil,
|
215
|
+
}
|
216
|
+
obj_ = ::RGeo::GeoJSON.decode(json_, :geo_factory => @geo_factory)
|
217
|
+
assert_not_nil(obj_)
|
218
|
+
assert_nil(obj_.geometry)
|
219
|
+
assert_equal({}, obj_.properties)
|
171
220
|
end
|
172
221
|
|
173
222
|
|
@@ -183,7 +232,7 @@ module RGeo
|
|
183
232
|
'properties' => {'prop1' => 'foo', 'prop2' => 'bar'},
|
184
233
|
}
|
185
234
|
assert_equal(json_, ::RGeo::GeoJSON.encode(object_))
|
186
|
-
assert(::RGeo::GeoJSON.decode(json_, @geo_factory).eql?(object_))
|
235
|
+
assert(::RGeo::GeoJSON.decode(json_, :geo_factory => @geo_factory).eql?(object_))
|
187
236
|
end
|
188
237
|
|
189
238
|
|
@@ -220,7 +269,7 @@ module RGeo
|
|
220
269
|
]
|
221
270
|
}
|
222
271
|
assert_equal(json_, ::RGeo::GeoJSON.encode(object_))
|
223
|
-
assert(::RGeo::GeoJSON.decode(json_, @geo_factory).eql?(object_))
|
272
|
+
assert(::RGeo::GeoJSON.decode(json_, :geo_factory => @geo_factory).eql?(object_))
|
224
273
|
end
|
225
274
|
|
226
275
|
|
@@ -0,0 +1,249 @@
|
|
1
|
+
# -----------------------------------------------------------------------------
|
2
|
+
#
|
3
|
+
# Tests for WKT generator
|
4
|
+
#
|
5
|
+
# -----------------------------------------------------------------------------
|
6
|
+
# Copyright 2010 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'
|
38
|
+
require 'rgeo'
|
39
|
+
|
40
|
+
|
41
|
+
module RGeo
|
42
|
+
module Tests # :nodoc:
|
43
|
+
module WKRep # :nodoc:
|
44
|
+
|
45
|
+
class TestWKBGenerator < ::Test::Unit::TestCase # :nodoc:
|
46
|
+
|
47
|
+
|
48
|
+
def setup
|
49
|
+
@factory = ::RGeo::Cartesian.simple_factory(:srid => 1000)
|
50
|
+
@factoryz = ::RGeo::Cartesian.simple_factory(:srid => 1000, :support_z_coordinate => true)
|
51
|
+
@factorym = ::RGeo::Cartesian.simple_factory(:srid => 1000, :support_m_coordinate => true)
|
52
|
+
@factoryzm = ::RGeo::Cartesian.simple_factory(:srid => 1000, :support_z_coordinate => true, :support_m_coordinate => true)
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
def test_point_basic_xdr
|
57
|
+
generator_ = ::RGeo::WKRep::WKBGenerator.new(:hex_format => true)
|
58
|
+
obj_ = @factory.point(1, 2)
|
59
|
+
assert_equal('00000000013ff00000000000004000000000000000', generator_.generate(obj_))
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
def test_point_basic_ndr
|
64
|
+
generator_ = ::RGeo::WKRep::WKBGenerator.new(:hex_format => true, :little_endian => true)
|
65
|
+
obj_ = @factory.point(1, 2)
|
66
|
+
assert_equal('0101000000000000000000f03f0000000000000040', generator_.generate(obj_))
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
def test_point_2d_ewkb
|
71
|
+
generator_ = ::RGeo::WKRep::WKBGenerator.new(:hex_format => true, :type_format => :ewkb)
|
72
|
+
obj_ = @factory.point(1, 2)
|
73
|
+
assert_equal('00000000013ff00000000000004000000000000000', generator_.generate(obj_))
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
def test_point_2d_wkb12
|
78
|
+
generator_ = ::RGeo::WKRep::WKBGenerator.new(:hex_format => true, :type_format => :wkb12)
|
79
|
+
obj_ = @factory.point(1, 2)
|
80
|
+
assert_equal('00000000013ff00000000000004000000000000000', generator_.generate(obj_))
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
def test_point_2d_ewkb_with_srid
|
85
|
+
generator_ = ::RGeo::WKRep::WKBGenerator.new(:hex_format => true, :type_format => :ewkb, :emit_ewkb_srid => true)
|
86
|
+
obj_ = @factory.point(1, 2)
|
87
|
+
assert_equal('0020000001000003e83ff00000000000004000000000000000', generator_.generate(obj_))
|
88
|
+
end
|
89
|
+
|
90
|
+
|
91
|
+
def test_point_with_ewkb_z
|
92
|
+
generator_ = ::RGeo::WKRep::WKBGenerator.new(:hex_format => true, :type_format => :ewkb)
|
93
|
+
obj_ = @factoryz.point(1, 2, 3)
|
94
|
+
assert_equal('00800000013ff000000000000040000000000000004008000000000000', generator_.generate(obj_))
|
95
|
+
end
|
96
|
+
|
97
|
+
|
98
|
+
def test_point_with_ewkb_m
|
99
|
+
generator_ = ::RGeo::WKRep::WKBGenerator.new(:hex_format => true, :type_format => :ewkb)
|
100
|
+
obj_ = @factorym.point(1, 2, 3)
|
101
|
+
assert_equal('00400000013ff000000000000040000000000000004008000000000000', generator_.generate(obj_))
|
102
|
+
end
|
103
|
+
|
104
|
+
|
105
|
+
def test_point_with_ewkb_zm
|
106
|
+
generator_ = ::RGeo::WKRep::WKBGenerator.new(:hex_format => true, :type_format => :ewkb)
|
107
|
+
obj_ = @factoryzm.point(1, 2, 3, 4)
|
108
|
+
assert_equal('00c00000013ff0000000000000400000000000000040080000000000004010000000000000', generator_.generate(obj_))
|
109
|
+
end
|
110
|
+
|
111
|
+
|
112
|
+
def test_point_with_wkb12_z
|
113
|
+
generator_ = ::RGeo::WKRep::WKBGenerator.new(:hex_format => true, :type_format => :wkb12)
|
114
|
+
obj_ = @factoryz.point(1, 2, 3)
|
115
|
+
assert_equal('00000003e93ff000000000000040000000000000004008000000000000', generator_.generate(obj_))
|
116
|
+
end
|
117
|
+
|
118
|
+
|
119
|
+
def test_point_with_wkb12_m
|
120
|
+
generator_ = ::RGeo::WKRep::WKBGenerator.new(:hex_format => true, :type_format => :wkb12)
|
121
|
+
obj_ = @factorym.point(1, 2, 3)
|
122
|
+
assert_equal('00000007d13ff000000000000040000000000000004008000000000000', generator_.generate(obj_))
|
123
|
+
end
|
124
|
+
|
125
|
+
|
126
|
+
def test_point_with_wkb12_zm
|
127
|
+
generator_ = ::RGeo::WKRep::WKBGenerator.new(:hex_format => true, :type_format => :wkb12)
|
128
|
+
obj_ = @factoryzm.point(1, 2, 3, 4)
|
129
|
+
assert_equal('0000000bb93ff0000000000000400000000000000040080000000000004010000000000000', generator_.generate(obj_))
|
130
|
+
end
|
131
|
+
|
132
|
+
|
133
|
+
def test_linestring_basic
|
134
|
+
generator_ = ::RGeo::WKRep::WKBGenerator.new(:hex_format => true)
|
135
|
+
obj_ = @factory.line_string([@factory.point(1, 2), @factory.point(3, 4), @factory.point(5, 6)])
|
136
|
+
assert_equal('0000000002000000033ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000', generator_.generate(obj_))
|
137
|
+
end
|
138
|
+
|
139
|
+
|
140
|
+
def test_linestring_with_ewkb_z
|
141
|
+
generator_ = ::RGeo::WKRep::WKBGenerator.new(:hex_format => true, :type_format => :ewkb)
|
142
|
+
obj_ = @factoryz.line_string([@factoryz.point(1, 2, 3), @factoryz.point(4, 5, 6)])
|
143
|
+
assert_equal('0080000002000000023ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000', generator_.generate(obj_))
|
144
|
+
end
|
145
|
+
|
146
|
+
|
147
|
+
def test_linestring_with_ewkb_z_and_srid
|
148
|
+
generator_ = ::RGeo::WKRep::WKBGenerator.new(:hex_format => true, :type_format => :ewkb, :emit_ewkb_srid => true)
|
149
|
+
obj_ = @factoryz.line_string([@factoryz.point(1, 2, 3), @factoryz.point(4, 5, 6)])
|
150
|
+
assert_equal('00a0000002000003e8000000023ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000', generator_.generate(obj_))
|
151
|
+
end
|
152
|
+
|
153
|
+
|
154
|
+
def test_linestring_with_wkb12_m
|
155
|
+
generator_ = ::RGeo::WKRep::WKBGenerator.new(:hex_format => true, :type_format => :wkb12)
|
156
|
+
obj_ = @factorym.line_string([@factorym.point(1, 2, 3), @factorym.point(4, 5, 6)])
|
157
|
+
assert_equal('00000007d2000000023ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000', generator_.generate(obj_))
|
158
|
+
end
|
159
|
+
|
160
|
+
|
161
|
+
def test_linestring_empty
|
162
|
+
generator_ = ::RGeo::WKRep::WKBGenerator.new(:hex_format => true)
|
163
|
+
obj_ = @factory.line_string([])
|
164
|
+
assert_equal('000000000200000000', generator_.generate(obj_))
|
165
|
+
end
|
166
|
+
|
167
|
+
|
168
|
+
def test_polygon_basic
|
169
|
+
generator_ = ::RGeo::WKRep::WKBGenerator.new(:hex_format => true)
|
170
|
+
obj_ = @factory.polygon(@factory.linear_ring([@factory.point(1, 2), @factory.point(3, 4), @factory.point(6, 5), @factory.point(1, 2)]))
|
171
|
+
assert_equal('000000000300000001000000043ff0000000000000400000000000000040080000000000004010000000000000401800000000000040140000000000003ff00000000000004000000000000000', generator_.generate(obj_))
|
172
|
+
end
|
173
|
+
|
174
|
+
|
175
|
+
def test_polygon_empty
|
176
|
+
generator_ = ::RGeo::WKRep::WKBGenerator.new(:hex_format => true)
|
177
|
+
obj_ = @factory.polygon(@factory.linear_ring([]))
|
178
|
+
assert_equal('000000000300000000', generator_.generate(obj_))
|
179
|
+
end
|
180
|
+
|
181
|
+
|
182
|
+
def test_multipoint_basic
|
183
|
+
generator_ = ::RGeo::WKRep::WKBGenerator.new(:hex_format => true)
|
184
|
+
obj_ = @factory.multi_point([@factory.point(1, 2), @factory.point(3, 4)])
|
185
|
+
assert_equal('00000000040000000200000000013ff00000000000004000000000000000000000000140080000000000004010000000000000', generator_.generate(obj_))
|
186
|
+
end
|
187
|
+
|
188
|
+
|
189
|
+
def test_multipoint_with_ewkb_z
|
190
|
+
generator_ = ::RGeo::WKRep::WKBGenerator.new(:hex_format => true, :type_format => :ewkb)
|
191
|
+
obj_ = @factoryz.multi_point([@factoryz.point(1, 2, 5), @factoryz.point(3, 4, 6)])
|
192
|
+
assert_equal('00800000040000000200800000013ff0000000000000400000000000000040140000000000000080000001400800000000000040100000000000004018000000000000', generator_.generate(obj_))
|
193
|
+
end
|
194
|
+
|
195
|
+
|
196
|
+
def test_multipoint_empty
|
197
|
+
generator_ = ::RGeo::WKRep::WKBGenerator.new(:hex_format => true)
|
198
|
+
obj_ = @factory.multi_point([])
|
199
|
+
assert_equal('000000000400000000', generator_.generate(obj_))
|
200
|
+
end
|
201
|
+
|
202
|
+
|
203
|
+
def test_multilinestring_basic
|
204
|
+
generator_ = ::RGeo::WKRep::WKBGenerator.new(:hex_format => true)
|
205
|
+
obj_ = @factory.multi_line_string([@factory.line_string([@factory.point(1, 2), @factory.point(3, 4), @factory.point(5, 6)]), @factory.line_string([@factory.point(-1, -2), @factory.point(-3, -4)])])
|
206
|
+
assert_equal('0000000005000000020000000002000000033ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000000000000200000002bff0000000000000c000000000000000c008000000000000c010000000000000', generator_.generate(obj_))
|
207
|
+
end
|
208
|
+
|
209
|
+
|
210
|
+
def test_multilinestring_empty
|
211
|
+
generator_ = ::RGeo::WKRep::WKBGenerator.new(:hex_format => true)
|
212
|
+
obj_ = @factory.multi_line_string([])
|
213
|
+
assert_equal('000000000500000000', generator_.generate(obj_))
|
214
|
+
end
|
215
|
+
|
216
|
+
|
217
|
+
def test_multipolygon_basic
|
218
|
+
generator_ = ::RGeo::WKRep::WKBGenerator.new(:hex_format => true)
|
219
|
+
obj_ = @factory.multi_polygon([@factory.polygon(@factory.linear_ring([@factory.point(1, 2), @factory.point(3, 4), @factory.point(6, 5), @factory.point(1, 2)])), @factory.polygon(@factory.linear_ring([]))])
|
220
|
+
assert_equal('000000000600000002000000000300000001000000043ff0000000000000400000000000000040080000000000004010000000000000401800000000000040140000000000003ff00000000000004000000000000000000000000300000000', generator_.generate(obj_))
|
221
|
+
end
|
222
|
+
|
223
|
+
|
224
|
+
def test_multipolygon_empty
|
225
|
+
generator_ = ::RGeo::WKRep::WKBGenerator.new(:hex_format => true)
|
226
|
+
obj_ = @factory.multi_polygon([])
|
227
|
+
assert_equal('000000000600000000', generator_.generate(obj_))
|
228
|
+
end
|
229
|
+
|
230
|
+
|
231
|
+
def test_collection_basic
|
232
|
+
generator_ = ::RGeo::WKRep::WKBGenerator.new(:hex_format => true)
|
233
|
+
obj_ = @factory.collection([@factory.line_string([@factory.point(1, 2), @factory.point(3, 4), @factory.point(5, 6)]), @factory.point(-1, -2)])
|
234
|
+
assert_equal('0000000007000000020000000002000000033ff0000000000000400000000000000040080000000000004010000000000000401400000000000040180000000000000000000001bff0000000000000c000000000000000', generator_.generate(obj_))
|
235
|
+
end
|
236
|
+
|
237
|
+
|
238
|
+
def test_collection_empty
|
239
|
+
generator_ = ::RGeo::WKRep::WKBGenerator.new(:hex_format => true)
|
240
|
+
obj_ = @factory.collection([])
|
241
|
+
assert_equal('000000000700000000', generator_.generate(obj_))
|
242
|
+
end
|
243
|
+
|
244
|
+
|
245
|
+
end
|
246
|
+
|
247
|
+
end
|
248
|
+
end
|
249
|
+
end
|
@@ -0,0 +1,353 @@
|
|
1
|
+
# -----------------------------------------------------------------------------
|
2
|
+
#
|
3
|
+
# Tests for WKT parser
|
4
|
+
#
|
5
|
+
# -----------------------------------------------------------------------------
|
6
|
+
# Copyright 2010 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'
|
38
|
+
require 'rgeo'
|
39
|
+
|
40
|
+
|
41
|
+
module RGeo
|
42
|
+
module Tests # :nodoc:
|
43
|
+
module WKRep # :nodoc:
|
44
|
+
|
45
|
+
class TestWKBParser < ::Test::Unit::TestCase # :nodoc:
|
46
|
+
|
47
|
+
|
48
|
+
def test_point_2d_xdr
|
49
|
+
parser_ = ::RGeo::WKRep::WKBParser.new
|
50
|
+
obj_ = parser_.parse_hex('00000000013ff00000000000004000000000000000')
|
51
|
+
assert_equal(::RGeo::Features::Point, obj_.geometry_type)
|
52
|
+
assert_equal(1, obj_.x)
|
53
|
+
assert_equal(2, obj_.y)
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
def test_point_2d_ndr
|
58
|
+
parser_ = ::RGeo::WKRep::WKBParser.new
|
59
|
+
obj_ = parser_.parse_hex('0101000000000000000000f03f0000000000000040')
|
60
|
+
assert_equal(::RGeo::Features::Point, obj_.geometry_type)
|
61
|
+
assert_equal(1, obj_.x)
|
62
|
+
assert_equal(2, obj_.y)
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
def test_point_with_ewkb_z
|
67
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true)
|
68
|
+
parser_ = ::RGeo::WKRep::WKBParser.new(:default_factory => factory_, :support_ewkb => true)
|
69
|
+
obj_ = parser_.parse_hex('00800000013ff000000000000040000000000000004008000000000000')
|
70
|
+
assert_equal(::RGeo::Features::Point, obj_.geometry_type)
|
71
|
+
assert_equal(3, obj_.z)
|
72
|
+
assert_nil(obj_.m)
|
73
|
+
end
|
74
|
+
|
75
|
+
|
76
|
+
def test_point_with_ewkb_m
|
77
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:support_m_coordinate => true)
|
78
|
+
parser_ = ::RGeo::WKRep::WKBParser.new(:default_factory => factory_, :support_ewkb => true)
|
79
|
+
obj_ = parser_.parse_hex('00400000013ff000000000000040000000000000004008000000000000')
|
80
|
+
assert_equal(::RGeo::Features::Point, obj_.geometry_type)
|
81
|
+
assert_equal(3, obj_.m)
|
82
|
+
assert_nil(obj_.z)
|
83
|
+
end
|
84
|
+
|
85
|
+
|
86
|
+
def test_point_with_ewkb_zm
|
87
|
+
factory_ = ::RGeo::Cartesian.simple_factory(:support_z_coordinate => true, :support_m_coordinate => true)
|
88
|
+
parser_ = ::RGeo::WKRep::WKBParser.new(:default_factory => factory_, :support_ewkb => true)
|
89
|
+
obj_ = parser_.parse_hex('00c00000013ff0000000000000400000000000000040080000000000004010000000000000')
|
90
|
+
assert_equal(::RGeo::Features::Point, obj_.geometry_type)
|
91
|
+
assert_equal(3, obj_.z)
|
92
|
+
assert_equal(4, obj_.m)
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
def test_point_with_wkb12_z
|
97
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true)
|
98
|
+
parser_ = ::RGeo::WKRep::WKBParser.new(:default_factory => factory_, :support_wkb12 => true)
|
99
|
+
obj_ = parser_.parse_hex('00000003e93ff000000000000040000000000000004008000000000000')
|
100
|
+
assert_equal(::RGeo::Features::Point, obj_.geometry_type)
|
101
|
+
assert_equal(3, obj_.z)
|
102
|
+
assert_nil(obj_.m)
|
103
|
+
end
|
104
|
+
|
105
|
+
|
106
|
+
def test_point_with_wkb12_m
|
107
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:support_m_coordinate => true)
|
108
|
+
parser_ = ::RGeo::WKRep::WKBParser.new(:default_factory => factory_, :support_wkb12 => true)
|
109
|
+
obj_ = parser_.parse_hex('00000007d13ff000000000000040000000000000004008000000000000')
|
110
|
+
assert_equal(::RGeo::Features::Point, obj_.geometry_type)
|
111
|
+
assert_equal(3, obj_.m)
|
112
|
+
assert_nil(obj_.z)
|
113
|
+
end
|
114
|
+
|
115
|
+
|
116
|
+
def test_point_with_wkb12_zm
|
117
|
+
factory_ = ::RGeo::Cartesian.simple_factory(:support_z_coordinate => true, :support_m_coordinate => true)
|
118
|
+
parser_ = ::RGeo::WKRep::WKBParser.new(:default_factory => factory_, :support_wkb12 => true)
|
119
|
+
obj_ = parser_.parse_hex('0000000bb93ff0000000000000400000000000000040080000000000004010000000000000')
|
120
|
+
assert_equal(::RGeo::Features::Point, obj_.geometry_type)
|
121
|
+
assert_equal(3, obj_.z)
|
122
|
+
assert_equal(4, obj_.m)
|
123
|
+
end
|
124
|
+
|
125
|
+
|
126
|
+
def test_point_with_wkb12_z_without_wkb12_support
|
127
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true)
|
128
|
+
parser_ = ::RGeo::WKRep::WKBParser.new(:default_factory => factory_)
|
129
|
+
assert_raise(::RGeo::Errors::ParseError) do
|
130
|
+
obj_ = parser_.parse_hex('00000003e93ff000000000000040000000000000004008000000000000')
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
|
135
|
+
def test_point_with_wkb12_z_without_enough_data
|
136
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true)
|
137
|
+
parser_ = ::RGeo::WKRep::WKBParser.new(:default_factory => factory_, :support_wkb12 => true)
|
138
|
+
assert_raise(::RGeo::Errors::ParseError) do
|
139
|
+
obj_ = parser_.parse_hex('00000003e93ff00000000000004000000000000000')
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
|
144
|
+
def test_point_with_ewkb_z_and_srid
|
145
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true)
|
146
|
+
parser_ = ::RGeo::WKRep::WKBParser.new(:default_factory => factory_, :support_ewkb => true)
|
147
|
+
parser_.set_factory_from_srid do |srid_|
|
148
|
+
::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true, :srid => srid_)
|
149
|
+
end
|
150
|
+
obj_ = parser_.parse_hex('00a0000001000003e83ff000000000000040000000000000004008000000000000')
|
151
|
+
assert_equal(::RGeo::Features::Point, obj_.geometry_type)
|
152
|
+
assert_equal(3, obj_.z)
|
153
|
+
assert_nil(obj_.m)
|
154
|
+
assert_equal(1000, obj_.srid)
|
155
|
+
end
|
156
|
+
|
157
|
+
|
158
|
+
def test_linestring_basic
|
159
|
+
parser_ = ::RGeo::WKRep::WKBParser.new
|
160
|
+
obj_ = parser_.parse_hex('0000000002000000033ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000')
|
161
|
+
assert_equal(::RGeo::Features::LineString, obj_.geometry_type)
|
162
|
+
assert_equal(3, obj_.num_points)
|
163
|
+
assert_equal(1, obj_.point_n(0).x)
|
164
|
+
assert_equal(6, obj_.point_n(2).y)
|
165
|
+
end
|
166
|
+
|
167
|
+
|
168
|
+
def test_linestring_with_ewkb_z
|
169
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true)
|
170
|
+
parser_ = ::RGeo::WKRep::WKBParser.new(:default_factory => factory_, :support_ewkb => true)
|
171
|
+
obj_ = parser_.parse_hex('0080000002000000023ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000')
|
172
|
+
assert_equal(::RGeo::Features::LineString, obj_.geometry_type)
|
173
|
+
assert_equal(2, obj_.num_points)
|
174
|
+
assert_equal(1, obj_.point_n(0).x)
|
175
|
+
assert_equal(6, obj_.point_n(1).z)
|
176
|
+
end
|
177
|
+
|
178
|
+
|
179
|
+
def test_linestring_with_ewkb_z_and_srid
|
180
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true)
|
181
|
+
parser_ = ::RGeo::WKRep::WKBParser.new(:default_factory => factory_, :support_ewkb => true)
|
182
|
+
parser_.set_factory_from_srid do |srid_|
|
183
|
+
::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true, :srid => srid_)
|
184
|
+
end
|
185
|
+
obj_ = parser_.parse_hex('00a0000002000003e8000000023ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000')
|
186
|
+
assert_equal(::RGeo::Features::LineString, obj_.geometry_type)
|
187
|
+
assert_equal(2, obj_.num_points)
|
188
|
+
assert_equal(1, obj_.point_n(0).x)
|
189
|
+
assert_equal(6, obj_.point_n(1).z)
|
190
|
+
assert_equal(1000, obj_.srid)
|
191
|
+
end
|
192
|
+
|
193
|
+
|
194
|
+
def test_linestring_with_wkb12_z
|
195
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true)
|
196
|
+
parser_ = ::RGeo::WKRep::WKBParser.new(:default_factory => factory_, :support_wkb12 => true)
|
197
|
+
obj_ = parser_.parse_hex('00000003ea000000023ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000')
|
198
|
+
assert_equal(::RGeo::Features::LineString, obj_.geometry_type)
|
199
|
+
assert_equal(2, obj_.num_points)
|
200
|
+
assert_equal(1, obj_.point_n(0).x)
|
201
|
+
assert_equal(6, obj_.point_n(1).z)
|
202
|
+
end
|
203
|
+
|
204
|
+
|
205
|
+
def test_linestring_empty
|
206
|
+
parser_ = ::RGeo::WKRep::WKBParser.new
|
207
|
+
obj_ = parser_.parse_hex('000000000200000000')
|
208
|
+
assert_equal(::RGeo::Features::LineString, obj_.geometry_type)
|
209
|
+
assert_equal(0, obj_.num_points)
|
210
|
+
end
|
211
|
+
|
212
|
+
|
213
|
+
def test_polygon_basic
|
214
|
+
parser_ = ::RGeo::WKRep::WKBParser.new
|
215
|
+
obj_ = parser_.parse_hex('000000000300000001000000043ff0000000000000400000000000000040080000000000004010000000000000401800000000000040140000000000003ff00000000000004000000000000000')
|
216
|
+
assert_equal(::RGeo::Features::Polygon, obj_.geometry_type)
|
217
|
+
assert_equal(4, obj_.exterior_ring.num_points)
|
218
|
+
assert_equal(1, obj_.exterior_ring.point_n(0).x)
|
219
|
+
assert_equal(5, obj_.exterior_ring.point_n(2).y)
|
220
|
+
end
|
221
|
+
|
222
|
+
|
223
|
+
def test_polygon_empty
|
224
|
+
parser_ = ::RGeo::WKRep::WKBParser.new
|
225
|
+
obj_ = parser_.parse_hex('000000000300000000')
|
226
|
+
assert_equal(::RGeo::Features::Polygon, obj_.geometry_type)
|
227
|
+
assert_equal(0, obj_.exterior_ring.num_points)
|
228
|
+
end
|
229
|
+
|
230
|
+
|
231
|
+
def test_multipoint_basic
|
232
|
+
parser_ = ::RGeo::WKRep::WKBParser.new
|
233
|
+
obj_ = parser_.parse_hex('00000000040000000200000000013ff00000000000004000000000000000000000000140080000000000004010000000000000')
|
234
|
+
assert_equal(::RGeo::Features::MultiPoint, obj_.geometry_type)
|
235
|
+
assert_equal(2, obj_.num_geometries)
|
236
|
+
assert_equal(1, obj_[0].x)
|
237
|
+
assert_equal(4, obj_[1].y)
|
238
|
+
end
|
239
|
+
|
240
|
+
|
241
|
+
def test_multipoint_mixed_byte_order
|
242
|
+
parser_ = ::RGeo::WKRep::WKBParser.new
|
243
|
+
obj_ = parser_.parse_hex('0000000004000000020101000000000000000000f03f0000000000000040000000000140080000000000004010000000000000')
|
244
|
+
assert_equal(::RGeo::Features::MultiPoint, obj_.geometry_type)
|
245
|
+
assert_equal(2, obj_.num_geometries)
|
246
|
+
assert_equal(1, obj_[0].x)
|
247
|
+
assert_equal(4, obj_[1].y)
|
248
|
+
end
|
249
|
+
|
250
|
+
|
251
|
+
def test_multipoint_with_ewkb_z
|
252
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true)
|
253
|
+
parser_ = ::RGeo::WKRep::WKBParser.new(:default_factory => factory_, :support_ewkb => true)
|
254
|
+
obj_ = parser_.parse_hex('00800000040000000200800000013ff0000000000000400000000000000040140000000000000080000001400800000000000040100000000000004018000000000000')
|
255
|
+
assert_equal(::RGeo::Features::MultiPoint, obj_.geometry_type)
|
256
|
+
assert_equal(2, obj_.num_geometries)
|
257
|
+
assert_equal(1, obj_[0].x)
|
258
|
+
assert_equal(5, obj_[0].z)
|
259
|
+
assert_equal(4, obj_[1].y)
|
260
|
+
assert_equal(6, obj_[1].z)
|
261
|
+
assert_nil(obj_[0].m)
|
262
|
+
end
|
263
|
+
|
264
|
+
|
265
|
+
def test_multipoint_ewkb_with_mixed_z
|
266
|
+
factory_ = ::RGeo::Cartesian.preferred_factory(:support_z_coordinate => true)
|
267
|
+
parser_ = ::RGeo::WKRep::WKBParser.new(:default_factory => factory_, :support_ewkb => true)
|
268
|
+
assert_raise(::RGeo::Errors::ParseError) do
|
269
|
+
obj_ = parser_.parse_hex('00800000040000000200800000013ff000000000000040000000000000004014000000000000000000000140080000000000004010000000000000')
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
|
274
|
+
def test_multipoint_empty
|
275
|
+
parser_ = ::RGeo::WKRep::WKBParser.new
|
276
|
+
obj_ = parser_.parse_hex('000000000400000000')
|
277
|
+
assert_equal(::RGeo::Features::MultiPoint, obj_.geometry_type)
|
278
|
+
assert_equal(0, obj_.num_geometries)
|
279
|
+
end
|
280
|
+
|
281
|
+
|
282
|
+
def test_multilinestring_basic
|
283
|
+
parser_ = ::RGeo::WKRep::WKBParser.new
|
284
|
+
obj_ = parser_.parse_hex('0000000005000000020000000002000000033ff000000000000040000000000000004008000000000000401000000000000040140000000000004018000000000000000000000200000002bff0000000000000c000000000000000c008000000000000c010000000000000')
|
285
|
+
assert_equal(::RGeo::Features::MultiLineString, obj_.geometry_type)
|
286
|
+
assert_equal(2, obj_.num_geometries)
|
287
|
+
assert_equal(1, obj_[0].point_n(0).x)
|
288
|
+
assert_equal(-4, obj_[1].point_n(1).y)
|
289
|
+
end
|
290
|
+
|
291
|
+
|
292
|
+
def test_multilinestring_wrong_element_type
|
293
|
+
parser_ = ::RGeo::WKRep::WKBParser.new
|
294
|
+
assert_raise(::RGeo::Errors::ParseError) do
|
295
|
+
obj_ = parser_.parse_hex('0000000005000000020000000002000000033ff00000000000004000000000000000400800000000000040100000000000004014000000000000401800000000000000000000013ff00000000000004000000000000000')
|
296
|
+
end
|
297
|
+
end
|
298
|
+
|
299
|
+
|
300
|
+
def test_multilinestring_empty
|
301
|
+
parser_ = ::RGeo::WKRep::WKBParser.new
|
302
|
+
obj_ = parser_.parse_hex('000000000500000000')
|
303
|
+
assert_equal(::RGeo::Features::MultiLineString, obj_.geometry_type)
|
304
|
+
assert_equal(0, obj_.num_geometries)
|
305
|
+
end
|
306
|
+
|
307
|
+
|
308
|
+
def test_multipolygon_basic
|
309
|
+
parser_ = ::RGeo::WKRep::WKBParser.new
|
310
|
+
obj_ = parser_.parse_hex('000000000600000002000000000300000001000000043ff0000000000000400000000000000040080000000000004010000000000000401800000000000040140000000000003ff00000000000004000000000000000000000000300000000')
|
311
|
+
assert_equal(::RGeo::Features::MultiPolygon, obj_.geometry_type)
|
312
|
+
assert_equal(2, obj_.num_geometries)
|
313
|
+
assert_equal(4, obj_[0].exterior_ring.num_points)
|
314
|
+
assert_equal(1, obj_[0].exterior_ring.point_n(0).x)
|
315
|
+
assert_equal(5, obj_[0].exterior_ring.point_n(2).y)
|
316
|
+
assert_equal(0, obj_[1].exterior_ring.num_points)
|
317
|
+
end
|
318
|
+
|
319
|
+
|
320
|
+
def test_multipolygon_empty
|
321
|
+
parser_ = ::RGeo::WKRep::WKBParser.new
|
322
|
+
obj_ = parser_.parse_hex('000000000600000000')
|
323
|
+
assert_equal(::RGeo::Features::MultiPolygon, obj_.geometry_type)
|
324
|
+
assert_equal(0, obj_.num_geometries)
|
325
|
+
end
|
326
|
+
|
327
|
+
|
328
|
+
def test_collection_basic
|
329
|
+
parser_ = ::RGeo::WKRep::WKBParser.new
|
330
|
+
obj_ = parser_.parse_hex('0000000007000000020000000002000000033ff0000000000000400000000000000040080000000000004010000000000000401400000000000040180000000000000000000001bff0000000000000c000000000000000')
|
331
|
+
assert_equal(::RGeo::Features::GeometryCollection, obj_.geometry_type)
|
332
|
+
assert_equal(2, obj_.num_geometries)
|
333
|
+
assert_equal(::RGeo::Features::LineString, obj_[0].geometry_type)
|
334
|
+
assert_equal(1, obj_[0].point_n(0).x)
|
335
|
+
assert_equal(6, obj_[0].point_n(2).y)
|
336
|
+
assert_equal(::RGeo::Features::Point, obj_[1].geometry_type)
|
337
|
+
assert_equal(-1, obj_[1].x)
|
338
|
+
end
|
339
|
+
|
340
|
+
|
341
|
+
def test_collection_empty
|
342
|
+
parser_ = ::RGeo::WKRep::WKBParser.new
|
343
|
+
obj_ = parser_.parse_hex('000000000700000000')
|
344
|
+
assert_equal(::RGeo::Features::GeometryCollection, obj_.geometry_type)
|
345
|
+
assert_equal(0, obj_.num_geometries)
|
346
|
+
end
|
347
|
+
|
348
|
+
|
349
|
+
end
|
350
|
+
|
351
|
+
end
|
352
|
+
end
|
353
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 16
|
9
|
+
version: 0.1.16
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Daniel Azuma
|
@@ -14,24 +14,10 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-11-
|
17
|
+
date: 2010-11-18 00:00:00 -08:00
|
18
18
|
default_executable:
|
19
|
-
dependencies:
|
20
|
-
|
21
|
-
name: json
|
22
|
-
prerelease: false
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
-
none: false
|
25
|
-
requirements:
|
26
|
-
- - ">="
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 1
|
30
|
-
- 4
|
31
|
-
- 6
|
32
|
-
version: 1.4.6
|
33
|
-
type: :runtime
|
34
|
-
version_requirements: *id001
|
19
|
+
dependencies: []
|
20
|
+
|
35
21
|
description: RGeo is a spatial 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. It also provides a suite of useful tools for writing location-based applications using Ruby-based frameworks such as Ruby On Rails.
|
36
22
|
email: dazuma@gmail.com
|
37
23
|
executables: []
|
@@ -146,6 +132,8 @@ files:
|
|
146
132
|
- tests/simple_spherical/tc_polygon.rb
|
147
133
|
- tests/tc_geojson.rb
|
148
134
|
- tests/tc_oneoff.rb
|
135
|
+
- tests/wkrep/tc_wkb_generator.rb
|
136
|
+
- tests/wkrep/tc_wkb_parser.rb
|
149
137
|
- tests/wkrep/tc_wkt_generator.rb
|
150
138
|
- tests/wkrep/tc_wkt_parser.rb
|
151
139
|
- ext/geos_c_impl/extconf.rb
|
@@ -241,5 +229,7 @@ test_files:
|
|
241
229
|
- tests/simple_spherical/tc_polygon.rb
|
242
230
|
- tests/tc_geojson.rb
|
243
231
|
- tests/tc_oneoff.rb
|
232
|
+
- tests/wkrep/tc_wkb_generator.rb
|
233
|
+
- tests/wkrep/tc_wkb_parser.rb
|
244
234
|
- tests/wkrep/tc_wkt_generator.rb
|
245
235
|
- tests/wkrep/tc_wkt_parser.rb
|