rgeo 0.3.17 → 0.3.18
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +6 -0
- data/Version +1 -1
- data/ext/geos_c_impl/factory.c +7 -0
- data/ext/proj4_c_impl/main.c +8 -1
- data/lib/rgeo/coord_sys/cs/entities.rb +20 -2
- data/lib/rgeo/coord_sys/cs/wkt_parser.rb +38 -16
- data/lib/rgeo/coord_sys/proj4.rb +25 -0
- data/lib/rgeo/geos/interface.rb +33 -2
- data/test/coord_sys/tc_active_record_table.rb +10 -2
- data/test/coord_sys/tc_ogc_cs.rb +18 -0
- data/test/coord_sys/tc_proj4.rb +5 -0
- data/test/coord_sys/tc_proj4_srs_data.rb +5 -1
- data/test/geos_capi/tc_misc.rb +5 -0
- data/test/geos_capi/tc_multi_polygon.rb +9 -0
- data/test/tc_oneoff.rb +2 -1
- metadata +2 -2
data/History.rdoc
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
=== 0.3.18 / 2012-09-19
|
2
|
+
|
3
|
+
* The coordinate system WKT parser now recognizes the nonstandard "EXTENSION" node. This node is not part of the WKT, but it is present in some data sets, including the coordinate systems shipped with Proj 4.8, so we now support it.
|
4
|
+
* Updated some of the other test cases to work with the specific data that ships with Proj 4.8.
|
5
|
+
* New APIs to access the underlying version of Geos and Proj.
|
6
|
+
|
1
7
|
=== 0.3.17 / 2012-08-21
|
2
8
|
|
3
9
|
* Geos-based implementations crashed when an operation resulted in an empty point, e.g. taking the centroid of an empty MultiPolygon on recent versions of Geos. Fixed. Such operations now return the empty GeometryCollection for the time being, to match the behavior of older versions of Geos. (Reported by Ben Hughes)
|
data/Version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.18
|
data/ext/geos_c_impl/factory.c
CHANGED
@@ -415,6 +415,12 @@ static VALUE method_factory_write_for_psych(VALUE self, VALUE obj)
|
|
415
415
|
}
|
416
416
|
|
417
417
|
|
418
|
+
static VALUE cmethod_factory_geos_version(VALUE klass)
|
419
|
+
{
|
420
|
+
return rb_str_new2(GEOS_VERSION);
|
421
|
+
}
|
422
|
+
|
423
|
+
|
418
424
|
static VALUE cmethod_factory_create(VALUE klass, VALUE flags, VALUE srid, VALUE buffer_resolution,
|
419
425
|
VALUE wkt_generator, VALUE wkb_generator, VALUE proj4_obj, VALUE coord_sys_obj)
|
420
426
|
{
|
@@ -646,6 +652,7 @@ RGeo_Globals* rgeo_init_geos_factory()
|
|
646
652
|
rb_define_method(geos_factory_class, "_read_for_psych", method_factory_read_for_psych, 1);
|
647
653
|
rb_define_method(geos_factory_class, "_write_for_psych", method_factory_write_for_psych, 1);
|
648
654
|
rb_define_module_function(geos_factory_class, "_create", cmethod_factory_create, 7);
|
655
|
+
rb_define_module_function(geos_factory_class, "_geos_version", cmethod_factory_geos_version, 0);
|
649
656
|
|
650
657
|
// Pre-define implementation classes and set up allocation methods
|
651
658
|
globals->geos_geometry = rb_define_class_under(globals->geos_module, "CAPIGeometryImpl", rb_cObject);
|
data/ext/proj4_c_impl/main.c
CHANGED
@@ -252,7 +252,13 @@ static VALUE method_proj4_is_valid(VALUE self)
|
|
252
252
|
}
|
253
253
|
|
254
254
|
|
255
|
-
static VALUE
|
255
|
+
static VALUE cmethod_proj4_version(VALUE module)
|
256
|
+
{
|
257
|
+
return INT2NUM(PJ_VERSION);
|
258
|
+
}
|
259
|
+
|
260
|
+
|
261
|
+
static VALUE cmethod_proj4_transform(VALUE module, VALUE from, VALUE to, VALUE x, VALUE y, VALUE z)
|
256
262
|
{
|
257
263
|
VALUE result;
|
258
264
|
projPJ from_pj;
|
@@ -324,6 +330,7 @@ static void rgeo_init_proj4()
|
|
324
330
|
rb_define_method(proj4_class, "_radians?", method_proj4_uses_radians, 0);
|
325
331
|
rb_define_method(proj4_class, "_get_geographic", method_proj4_get_geographic, 0);
|
326
332
|
rb_define_module_function(proj4_class, "_transform_coords", cmethod_proj4_transform, 5);
|
333
|
+
rb_define_module_function(proj4_class, "_proj_version", cmethod_proj4_version, 0);
|
327
334
|
}
|
328
335
|
|
329
336
|
|
@@ -226,7 +226,12 @@ module RGeo
|
|
226
226
|
else
|
227
227
|
authority_ = ''
|
228
228
|
end
|
229
|
-
|
229
|
+
if defined?(@extensions) && @extensions
|
230
|
+
extensions_ = @extensions.map{ |k_, v_| ",EXTENSION#{open_}#{k_.inspect},#{v_.inspect}#{close_}" }.join
|
231
|
+
else
|
232
|
+
extensions_ = ''
|
233
|
+
end
|
234
|
+
"#{_wkt_typename}#{open_}#{@name.inspect}#{content_}#{extensions_}#{authority_}#{close_}"
|
230
235
|
end
|
231
236
|
|
232
237
|
|
@@ -486,16 +491,21 @@ module RGeo
|
|
486
491
|
# * <b>abbreviation</b>: an abbreviation
|
487
492
|
# * <b>alias</b>: an alias
|
488
493
|
# * <b>remarks</b>: provider-supplied remarks.
|
494
|
+
# * <b>extensions</b>: a hash of extension keys and values
|
489
495
|
|
490
496
|
class Info < Base
|
491
497
|
|
492
|
-
def initialize(name_, authority_=nil, authority_code_=nil, abbreviation_=nil, alias_=nil, remarks_=nil) # :nodoc:
|
498
|
+
def initialize(name_, authority_=nil, authority_code_=nil, abbreviation_=nil, alias_=nil, remarks_=nil, extensions_=nil) # :nodoc:
|
493
499
|
@name = name_
|
494
500
|
@authority = authority_ ? authority_.to_s : nil
|
495
501
|
@authority_code = authority_code_ ? authority_code_.to_s : nil
|
496
502
|
@abbreviation = abbreviation_ ? abbreviation_.to_s : nil
|
497
503
|
@alias = alias_ ? alias_.to_s : nil
|
498
504
|
@remarks = remarks_ ? remarks_.to_s : nil
|
505
|
+
@extensions = {}
|
506
|
+
if extensions_
|
507
|
+
extensions_.each{ |k_, v_| @extensions[k_.to_s] = v_.to_s }
|
508
|
+
end
|
499
509
|
end
|
500
510
|
|
501
511
|
|
@@ -529,6 +539,14 @@ module RGeo
|
|
529
539
|
# Gets the provider-supplied remarks.
|
530
540
|
attr_reader :remarks
|
531
541
|
|
542
|
+
# Gets the value of a keyed extension.
|
543
|
+
# This is not part of the OGC spec, but it is supported because
|
544
|
+
# some coordinate system databases (such as the spatial_ref_sys
|
545
|
+
# table for PostGIS 2.0) include it.
|
546
|
+
def extension(key_)
|
547
|
+
@extensions[key_.to_s]
|
548
|
+
end
|
549
|
+
|
532
550
|
|
533
551
|
end
|
534
552
|
|
@@ -52,8 +52,9 @@ module RGeo
|
|
52
52
|
|
53
53
|
def parse(containing_type_=nil)
|
54
54
|
if @cur_token.kind_of?(QuotedString) ||
|
55
|
-
|
56
|
-
|
55
|
+
@cur_token.kind_of?(::Numeric) ||
|
56
|
+
(containing_type_ == 'AXIS' && @cur_token.kind_of?(TypeString))
|
57
|
+
then
|
57
58
|
value_ = @cur_token
|
58
59
|
next_token
|
59
60
|
return value_
|
@@ -76,6 +77,8 @@ module RGeo
|
|
76
77
|
case type_
|
77
78
|
when 'AUTHORITY'
|
78
79
|
obj_ = AuthorityClause.new(args_.shift(QuotedString), args_.shift(QuotedString))
|
80
|
+
when 'EXTENSION'
|
81
|
+
obj_ = ExtensionClause.new(args_.shift(QuotedString), args_.shift(QuotedString))
|
79
82
|
when 'AXIS'
|
80
83
|
obj_ = AxisInfo.create(args_.shift(QuotedString), args_.shift(TypeString))
|
81
84
|
when 'TOWGS84'
|
@@ -93,27 +96,27 @@ module RGeo
|
|
93
96
|
else
|
94
97
|
klass_ = Unit
|
95
98
|
end
|
96
|
-
obj_ = klass_.create(args_.shift(QuotedString), args_.shift(::Numeric), *args_.
|
99
|
+
obj_ = klass_.create(args_.shift(QuotedString), args_.shift(::Numeric), *args_.create_optionals)
|
97
100
|
when 'PARAMETER'
|
98
101
|
obj_ = ProjectionParameter.create(args_.shift(QuotedString), args_.shift(::Numeric))
|
99
102
|
when 'PRIMEM'
|
100
|
-
obj_ = PrimeMeridian.create(args_.shift(QuotedString), nil, args_.shift(::Numeric), *args_.
|
103
|
+
obj_ = PrimeMeridian.create(args_.shift(QuotedString), nil, args_.shift(::Numeric), *args_.create_optionals)
|
101
104
|
when 'SPHEROID'
|
102
|
-
obj_ = Ellipsoid.create_flattened_sphere(args_.shift(QuotedString), args_.shift(::Numeric), args_.shift(::Numeric), args_.find_first(LinearUnit), *args_.
|
105
|
+
obj_ = Ellipsoid.create_flattened_sphere(args_.shift(QuotedString), args_.shift(::Numeric), args_.shift(::Numeric), args_.find_first(LinearUnit), *args_.create_optionals)
|
103
106
|
when 'PROJECTION'
|
104
107
|
name_ = args_.shift(QuotedString)
|
105
|
-
obj_ = Projection.create(name_, name_, args_.find_all(ProjectionParameter), *args_.
|
108
|
+
obj_ = Projection.create(name_, name_, args_.find_all(ProjectionParameter), *args_.create_optionals)
|
106
109
|
when 'DATUM'
|
107
110
|
name_ = args_.shift(QuotedString)
|
108
111
|
ellipsoid_ = args_.find_first(Ellipsoid)
|
109
112
|
to_wgs84_ = args_.find_first(WGS84ConversionInfo)
|
110
|
-
obj_ = HorizontalDatum.create(name_, HD_GEOCENTRIC, ellipsoid_, to_wgs84_, *args_.
|
113
|
+
obj_ = HorizontalDatum.create(name_, HD_GEOCENTRIC, ellipsoid_, to_wgs84_, *args_.create_optionals)
|
111
114
|
when 'VERT_DATUM'
|
112
|
-
obj_ = VerticalDatum.create(args_.shift(QuotedString), args_.shift(::Numeric), *args_.
|
115
|
+
obj_ = VerticalDatum.create(args_.shift(QuotedString), args_.shift(::Numeric), *args_.create_optionals)
|
113
116
|
when 'LOCAL_DATUM'
|
114
|
-
obj_ = LocalDatum.create(args_.shift(QuotedString), args_.shift(::Numeric), *args_.
|
117
|
+
obj_ = LocalDatum.create(args_.shift(QuotedString), args_.shift(::Numeric), *args_.create_optionals)
|
115
118
|
when 'COMPD_CS'
|
116
|
-
obj_ = CompoundCoordinateSystem.create(args_.shift(QuotedString), args_.shift(CoordinateSystem), args_.shift(CoordinateSystem), *args_.
|
119
|
+
obj_ = CompoundCoordinateSystem.create(args_.shift(QuotedString), args_.shift(CoordinateSystem), args_.shift(CoordinateSystem), *args_.create_optionals)
|
117
120
|
when 'LOCAL_CS'
|
118
121
|
name_ = args_.shift(QuotedString)
|
119
122
|
local_datum_ = args_.find_first(LocalDatum)
|
@@ -122,7 +125,7 @@ module RGeo
|
|
122
125
|
unless axes_.size > 0
|
123
126
|
raise Error::ParseError("Expected at least one AXIS in a LOCAL_CS")
|
124
127
|
end
|
125
|
-
obj_ = LocalCoordinateSystem.create(name_, local_datum_, unit_, axes_, *args_.
|
128
|
+
obj_ = LocalCoordinateSystem.create(name_, local_datum_, unit_, axes_, *args_.create_optionals)
|
126
129
|
when 'GEOCCS'
|
127
130
|
name_ = args_.shift(QuotedString)
|
128
131
|
horizontal_datum_ = args_.find_first(HorizontalDatum)
|
@@ -132,13 +135,13 @@ module RGeo
|
|
132
135
|
unless axes_.size == 0 || axes_.size == 3
|
133
136
|
raise Error::ParseError("GEOCCS must contain either 0 or 3 AXIS parameters")
|
134
137
|
end
|
135
|
-
obj_ = GeocentricCoordinateSystem.create(name_, horizontal_datum_, prime_meridian_, linear_unit_, axes_[0], axes_[1], axes_[2], *args_.
|
138
|
+
obj_ = GeocentricCoordinateSystem.create(name_, horizontal_datum_, prime_meridian_, linear_unit_, axes_[0], axes_[1], axes_[2], *args_.create_optionals)
|
136
139
|
when 'VERT_CS'
|
137
140
|
name_ = args_.shift(QuotedString)
|
138
141
|
vertical_datum_ = args_.find_first(VerticalDatum)
|
139
142
|
linear_unit_ = args_.find_first(LinearUnit)
|
140
143
|
axis_ = args_.find_first(AxisInfo)
|
141
|
-
obj_ = VerticalCoordinateSystem.create(name_, vertical_datum_, linear_unit_, axis_, *args_.
|
144
|
+
obj_ = VerticalCoordinateSystem.create(name_, vertical_datum_, linear_unit_, axis_, *args_.create_optionals)
|
142
145
|
when 'GEOGCS'
|
143
146
|
name_ = args_.shift(QuotedString)
|
144
147
|
horizontal_datum_ = args_.find_first(HorizontalDatum)
|
@@ -148,7 +151,7 @@ module RGeo
|
|
148
151
|
unless axes_.size == 0 || axes_.size == 2
|
149
152
|
raise Error::ParseError("GEOGCS must contain either 0 or 2 AXIS parameters")
|
150
153
|
end
|
151
|
-
obj_ = GeographicCoordinateSystem.create(name_, angular_unit_, horizontal_datum_, prime_meridian_, axes_[0], axes_[1], *args_.
|
154
|
+
obj_ = GeographicCoordinateSystem.create(name_, angular_unit_, horizontal_datum_, prime_meridian_, axes_[0], axes_[1], *args_.create_optionals)
|
152
155
|
when 'PROJCS'
|
153
156
|
name_ = args_.shift(QuotedString)
|
154
157
|
geographic_coordinate_system_ = args_.find_first(GeographicCoordinateSystem)
|
@@ -160,7 +163,7 @@ module RGeo
|
|
160
163
|
unless axes_.size == 0 || axes_.size == 2
|
161
164
|
raise Error::ParseError("PROJCS must contain either 0 or 2 AXIS parameters")
|
162
165
|
end
|
163
|
-
obj_ = ProjectedCoordinateSystem.create(name_, geographic_coordinate_system_, projection_, linear_unit_, axes_[0], axes_[1], *args_.
|
166
|
+
obj_ = ProjectedCoordinateSystem.create(name_, geographic_coordinate_system_, projection_, linear_unit_, axes_[0], axes_[1], *args_.create_optionals)
|
164
167
|
else
|
165
168
|
raise Error::ParseError, "Unrecognized type: #{type_}"
|
166
169
|
end
|
@@ -240,6 +243,19 @@ module RGeo
|
|
240
243
|
end
|
241
244
|
|
242
245
|
|
246
|
+
class ExtensionClause # :nodoc:
|
247
|
+
|
248
|
+
def initialize(key_, value_)
|
249
|
+
@key = key_
|
250
|
+
@value = value_
|
251
|
+
end
|
252
|
+
|
253
|
+
attr_reader :key
|
254
|
+
attr_reader :value
|
255
|
+
|
256
|
+
end
|
257
|
+
|
258
|
+
|
243
259
|
class ArgumentList # :nodoc:
|
244
260
|
|
245
261
|
def initialize
|
@@ -255,7 +271,7 @@ module RGeo
|
|
255
271
|
names_ = @values.map do |val_|
|
256
272
|
val_.kind_of?(Base) ? val_._wkt_typename : val_.inspect
|
257
273
|
end
|
258
|
-
raise Error::ParseError, "#{@
|
274
|
+
raise Error::ParseError, "#{@values.size} unexpected arguments: #{names_.join(', ')}"
|
259
275
|
end
|
260
276
|
end
|
261
277
|
|
@@ -283,6 +299,12 @@ module RGeo
|
|
283
299
|
results_
|
284
300
|
end
|
285
301
|
|
302
|
+
def create_optionals
|
303
|
+
hash_ = {}
|
304
|
+
find_all(ExtensionClause).each{ |ec_| hash_[ec_.key] = ec_.value }
|
305
|
+
(find_first(AuthorityClause) || [nil, nil]).to_a + [nil, nil, nil, hash_]
|
306
|
+
end
|
307
|
+
|
286
308
|
def shift(klass_=nil)
|
287
309
|
val_ = @values.shift
|
288
310
|
unless val_
|
data/lib/rgeo/coord_sys/proj4.rb
CHANGED
@@ -196,6 +196,31 @@ module RGeo
|
|
196
196
|
end
|
197
197
|
|
198
198
|
|
199
|
+
# Returns the Proj library version as a string of the format "x.y.z".
|
200
|
+
# Returns nil if Proj4 is not available.
|
201
|
+
|
202
|
+
def version_string
|
203
|
+
unless defined?(@version_string)
|
204
|
+
@version_string = respond_to?(:_proj_version) ? _proj_version.to_s.split('').join('.') : nil
|
205
|
+
end
|
206
|
+
@version_string
|
207
|
+
end
|
208
|
+
|
209
|
+
|
210
|
+
# Returns the Proj4 library version as a Versionomy object if the
|
211
|
+
# Versionomy library is available; otherwise as a string of the
|
212
|
+
# format "x.y.z".
|
213
|
+
# Returns nil if Proj4 is not available.
|
214
|
+
|
215
|
+
def version
|
216
|
+
unless defined?(@version)
|
217
|
+
str_ = version_string
|
218
|
+
@version = str_ && defined?(::Versionomy) ? ::Versionomy.parse(str_) : str_
|
219
|
+
end
|
220
|
+
@version
|
221
|
+
end
|
222
|
+
|
223
|
+
|
199
224
|
# Create a new Proj4 object, given a definition, which may be
|
200
225
|
# either a string or a hash. Returns nil if the given definition
|
201
226
|
# is invalid or Proj4 is not supported.
|
data/lib/rgeo/geos/interface.rb
CHANGED
@@ -41,14 +41,14 @@ module RGeo
|
|
41
41
|
class << self
|
42
42
|
|
43
43
|
|
44
|
-
# Returns true if CAPI GEOS implementation is supported.
|
44
|
+
# Returns true if the CAPI GEOS implementation is supported.
|
45
45
|
|
46
46
|
def capi_supported?
|
47
47
|
CAPI_SUPPORTED
|
48
48
|
end
|
49
49
|
|
50
50
|
|
51
|
-
# Returns true if FFI GEOS implementation is supported.
|
51
|
+
# Returns true if the FFI GEOS implementation is supported.
|
52
52
|
|
53
53
|
def ffi_supported?
|
54
54
|
FFI_SUPPORTED
|
@@ -95,6 +95,37 @@ module RGeo
|
|
95
95
|
end
|
96
96
|
|
97
97
|
|
98
|
+
# Returns the GEOS library version as a string of the format "x.y.z".
|
99
|
+
# Returns nil if GEOS is not available.
|
100
|
+
|
101
|
+
def version_string
|
102
|
+
unless defined?(@version_string)
|
103
|
+
if ::RGeo::Geos::CAPI_SUPPORTED
|
104
|
+
@version_string = ::RGeo::Geos::CAPIFactory._geos_version.freeze
|
105
|
+
elsif ::RGeo::Geos::FFI_SUPPORTED
|
106
|
+
@version_string = ::Geos::FFIGeos.GEOSversion.sub(/-CAPI-.*$/, '').freeze
|
107
|
+
else
|
108
|
+
@version_string = nil
|
109
|
+
end
|
110
|
+
end
|
111
|
+
@version_string
|
112
|
+
end
|
113
|
+
|
114
|
+
|
115
|
+
# Returns the GEOS library version as a Versionomy object if the
|
116
|
+
# Versionomy library is available; otherwise as a string of the
|
117
|
+
# format "x.y.z".
|
118
|
+
# Returns nil if GEOS is not available.
|
119
|
+
|
120
|
+
def version
|
121
|
+
unless defined?(@version)
|
122
|
+
str_ = version_string
|
123
|
+
@version = str_ && defined?(::Versionomy) ? ::Versionomy.parse(str_) : str_
|
124
|
+
end
|
125
|
+
@version
|
126
|
+
end
|
127
|
+
|
128
|
+
|
98
129
|
# The preferred native interface. This is the native interface
|
99
130
|
# used by default when a factory is created.
|
100
131
|
# Supported values are <tt>:capi</tt> and <tt>:ffi</tt>.
|
@@ -70,7 +70,11 @@ module RGeo
|
|
70
70
|
|
71
71
|
def test_4326
|
72
72
|
entry_ = @@db.get(4326)
|
73
|
-
|
73
|
+
allowed_vals_ = [
|
74
|
+
'+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs', # Proj 4.7
|
75
|
+
'+proj=longlat +datum=WGS84 +no_defs' # Proj 4.8
|
76
|
+
]
|
77
|
+
assert(allowed_vals_.include?(entry_.proj4.original_str))
|
74
78
|
assert_kind_of(::RGeo::CoordSys::CS::GeographicCoordinateSystem, entry_.coord_sys)
|
75
79
|
assert_equal('WGS 84', entry_.name)
|
76
80
|
end
|
@@ -78,7 +82,11 @@ module RGeo
|
|
78
82
|
|
79
83
|
def test_3785
|
80
84
|
entry_ = @@db.get(3785)
|
81
|
-
|
85
|
+
allowed_vals_ = [
|
86
|
+
'+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +units=m +k=1.0 +nadgrids=@null +no_defs', # Proj 4.7
|
87
|
+
'+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs' # Proj 4.8
|
88
|
+
]
|
89
|
+
assert(allowed_vals_.include?(entry_.proj4.original_str))
|
82
90
|
assert_kind_of(::RGeo::CoordSys::CS::ProjectedCoordinateSystem, entry_.coord_sys)
|
83
91
|
assert_equal('Popular Visualisation CRS / Mercator (deprecated)', entry_.name)
|
84
92
|
end
|
data/test/coord_sys/tc_ogc_cs.rb
CHANGED
@@ -185,6 +185,14 @@ module RGeo
|
|
185
185
|
end
|
186
186
|
|
187
187
|
|
188
|
+
def test_local_datum_with_extension
|
189
|
+
obj_ = ::RGeo::CoordSys::CS::LocalDatum.create('Random Local Datum', ::RGeo::CoordSys::CS::LD_MIN, nil, nil, nil, nil, nil, {:foo => :bar})
|
190
|
+
assert_equal('bar', obj_.extension(:foo))
|
191
|
+
assert_nil(obj_.extension(:bar))
|
192
|
+
assert_equal('LOCAL_DATUM["Random Local Datum",10000,EXTENSION["foo","bar"]]', obj_.to_wkt)
|
193
|
+
end
|
194
|
+
|
195
|
+
|
188
196
|
def test_vertical_datum
|
189
197
|
obj_ = ::RGeo::CoordSys::CS::VerticalDatum.create('Ordnance Datum Newlyn', ::RGeo::CoordSys::CS::VD_GEOID_MODE_DERIVED, 'EPSG', '5101')
|
190
198
|
assert_equal('Ordnance Datum Newlyn', obj_.name)
|
@@ -360,6 +368,16 @@ module RGeo
|
|
360
368
|
end
|
361
369
|
|
362
370
|
|
371
|
+
def test_parse_local_datum_with_extension
|
372
|
+
input_ = 'LOCAL_DATUM["Random Local Datum",10000,EXTENSION["foo","bar"]]'
|
373
|
+
obj_ = ::RGeo::CoordSys::CS.create_from_wkt(input_)
|
374
|
+
assert_kind_of(::RGeo::CoordSys::CS::LocalDatum, obj_)
|
375
|
+
assert_equal('bar', obj_.extension(:foo))
|
376
|
+
assert_nil(obj_.extension(:bar))
|
377
|
+
assert_equal(input_, obj_.to_wkt)
|
378
|
+
end
|
379
|
+
|
380
|
+
|
363
381
|
def test_marshal_roundtrip
|
364
382
|
input_ = 'COMPD_CS["OSGB36 / British National Grid + ODN",PROJCS["OSGB 1936 / British National Grid",GEOGCS["OSGB 1936",DATUM["OSGB 1936",SPHEROID["Airy 1830",6377563.396,299.3249646,AUTHORITY["EPSG","7001"]],TOWGS84[446.448,-125.157,542.06,0.15,0.247,0.842,-4.2261596151967575],AUTHORITY["EPSG","6277"]],PRIMEM["Greenwich",0.0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.017453292519943295],AXIS["Geodetic latitude",NORTH],AXIS["Geodetic longitude",EAST],AUTHORITY["EPSG","4277"]],PROJECTION["Transverse Mercator",AUTHORITY["EPSG","9807"]],PARAMETER["central_meridian",-2.0],PARAMETER["latitude_of_origin",49.0],PARAMETER["scale_factor",0.9996012717],PARAMETER["false_easting",400000.0],PARAMETER["false_northing",-100000.0],UNIT["m",1.0],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","27700"]],VERT_CS["Newlyn",VERT_DATUM["Ordnance Datum Newlyn",2005,AUTHORITY["EPSG","5101"]],UNIT["m",1.0],AXIS["Gravity-related height",UP],AUTHORITY["EPSG","5701"]],AUTHORITY["EPSG","7405"]]'
|
365
383
|
obj1_ = ::RGeo::CoordSys::CS.create_from_wkt(input_)
|
data/test/coord_sys/tc_proj4.rb
CHANGED
@@ -45,6 +45,11 @@ module RGeo
|
|
45
45
|
class TestProj4 < ::Test::Unit::TestCase # :nodoc:
|
46
46
|
|
47
47
|
|
48
|
+
def test_proj4_version
|
49
|
+
assert_match(/^\d+\.\d+(\.\d+)?$/, ::RGeo::CoordSys::Proj4.version_string)
|
50
|
+
end
|
51
|
+
|
52
|
+
|
48
53
|
def test_create_wgs84
|
49
54
|
proj_ = ::RGeo::CoordSys::Proj4.create('+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')
|
50
55
|
assert_equal(true, proj_.geographic?)
|
@@ -48,7 +48,11 @@ module RGeo
|
|
48
48
|
def test_epsg_4326
|
49
49
|
db_ = ::RGeo::CoordSys::SRSDatabase::Proj4Data.new('epsg')
|
50
50
|
entry_ = db_.get(4326)
|
51
|
-
|
51
|
+
allowed_vals_ = [
|
52
|
+
'+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs', # Proj 4.7
|
53
|
+
'+proj=longlat +datum=WGS84 +no_defs' # Proj 4.8
|
54
|
+
]
|
55
|
+
assert(allowed_vals_.include?(entry_.proj4.original_str))
|
52
56
|
assert_equal('WGS 84', entry_.name)
|
53
57
|
end
|
54
58
|
|
data/test/geos_capi/tc_misc.rb
CHANGED
@@ -63,6 +63,15 @@ module RGeo
|
|
63
63
|
end
|
64
64
|
|
65
65
|
|
66
|
+
def _test_geos_bug_582
|
67
|
+
f_ = ::RGeo::Geos.factory(:buffer_resolution => 2)
|
68
|
+
p1_ = f_.polygon(f_.linear_ring([]))
|
69
|
+
p2_ = f_.polygon(f_.linear_ring([f_.point(0, 0), f_.point(0, 1), f_.point(1, 1), f_.point(1, 0)]))
|
70
|
+
mp_ = f_.multi_polygon([p2_, p1_])
|
71
|
+
mp_.centroid.as_text
|
72
|
+
end
|
73
|
+
|
74
|
+
|
66
75
|
end
|
67
76
|
|
68
77
|
end
|
data/test/tc_oneoff.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rgeo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.18
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-19 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: RGeo is a geospatial data library for Ruby. It provides an implementation
|
15
15
|
of the Open Geospatial Consortium's Simple Features Specification, used by most
|