rgeo 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/History.rdoc +11 -0
  2. data/Version +1 -1
  3. data/ext/geos_c_impl/factory.c +134 -3
  4. data/ext/geos_c_impl/factory.h +5 -0
  5. data/ext/geos_c_impl/geometry_collection.c +18 -12
  6. data/lib/rgeo/cartesian/factory.rb +40 -33
  7. data/lib/rgeo/cartesian/interface.rb +6 -0
  8. data/lib/rgeo/coord_sys/cs/entities.rb +4 -4
  9. data/lib/rgeo/coord_sys/proj4.rb +5 -5
  10. data/lib/rgeo/coord_sys/srs_database/active_record_table.rb +5 -3
  11. data/lib/rgeo/feature/geometry.rb +8 -1
  12. data/lib/rgeo/geographic/factory.rb +124 -1
  13. data/lib/rgeo/geographic/interface.rb +6 -0
  14. data/lib/rgeo/geographic/proj4_projector.rb +6 -0
  15. data/lib/rgeo/geographic/simple_mercator_projector.rb +6 -0
  16. data/lib/rgeo/geos/factory.rb +119 -18
  17. data/lib/rgeo/geos/ffi_classes.rb +10 -5
  18. data/lib/rgeo/geos/ffi_factory.rb +106 -5
  19. data/lib/rgeo/geos/interface.rb +0 -2
  20. data/lib/rgeo/geos/zm_factory.rb +106 -2
  21. data/lib/rgeo/geos/zm_impl.rb +3 -2
  22. data/lib/rgeo/impl_helper.rb +1 -0
  23. data/lib/rgeo/impl_helper/basic_line_string_methods.rb +1 -1
  24. data/lib/rgeo/impl_helper/utils.rb +67 -0
  25. data/lib/rgeo/wkrep/wkb_generator.rb +4 -4
  26. data/lib/rgeo/wkrep/wkb_parser.rb +4 -4
  27. data/lib/rgeo/wkrep/wkt_generator.rb +4 -4
  28. data/lib/rgeo/wkrep/wkt_parser.rb +5 -5
  29. data/test/common/factory_tests.rb +117 -0
  30. data/test/common/geometry_collection_tests.rb +25 -0
  31. data/test/coord_sys/tc_active_record_table.rb +4 -5
  32. data/test/coord_sys/tc_ogc_cs.rb +0 -6
  33. data/test/coord_sys/tc_proj4.rb +4 -6
  34. data/test/geos_capi/tc_factory.rb +5 -33
  35. data/test/geos_capi/tc_zmfactory.rb +6 -0
  36. data/test/geos_ffi/tc_factory.rb +5 -33
  37. data/test/geos_ffi/tc_zmfactory.rb +6 -0
  38. data/test/projected_geographic/tc_factory.rb +63 -0
  39. data/test/simple_cartesian/tc_factory.rb +66 -0
  40. data/test/simple_mercator/tc_factory.rb +63 -0
  41. data/test/spherical_geographic/tc_factory.rb +66 -0
  42. data/test/tc_types.rb +4 -0
  43. metadata +12 -2
data/History.rdoc CHANGED
@@ -1,3 +1,14 @@
1
+ === 0.3.6 / 2012-03-06
2
+
3
+ * Geometry#relate? was incorrectly spelled "Geometry#relate" in the Feature::Geometry module and in some (but not all) implementations, leading to various types of method not found errors. Fixed. We'll keep #relate as a deprecated alias for the time being.
4
+ * Cloning a Geos CAPI factory caused a segfault. Fixed.
5
+ * Parsing a "well-known" format string using the ffi-geos implementation returned the low-level ffi-geos object rather than the RGeo feature if the generator was set to :geos. Fixed.
6
+ * GeometryCollection#each now returns an Enumerator if no block is given.
7
+ * Pure Ruby factories (simple_spherical, simple_cartesian) now support a :uses_lenient_assertions option, which disables assertion checking on LinearRing, Polygon, and MultiPolygon construction, since those checks can be expensive for large geometries.
8
+ * Fixed Rails 3.2 deprecation warning in SRSDatabase::ActiveRecordTable.
9
+ * Fixed an issue with the ActiveRecordTable tests on ActiveRecord 3.2.
10
+ * Further work towards YAML and mashal serialization support. Factories are now done, but geometries are not. I'm working actively on geometry serialization; it should be in place in the next release.
11
+
1
12
  === 0.3.5 / 2012-02-27
2
13
 
3
14
  * Reworked the terminology on equivalence levels. The documentation now names the three levels "spatial", "representational", and "objective" equivalence.
data/Version CHANGED
@@ -1 +1 @@
1
- 0.3.5
1
+ 0.3.6
@@ -69,7 +69,9 @@ static void message_handler(const char* fmt, ...)
69
69
 
70
70
  static void destroy_factory_func(RGeo_FactoryData* data)
71
71
  {
72
- GEOSContextHandle_t context = data->geos_context;
72
+ GEOSContextHandle_t context;
73
+
74
+ context = data->geos_context;
73
75
  if (data->wkt_reader) {
74
76
  GEOSWKTReader_destroy_r(context, data->wkt_reader);
75
77
  }
@@ -118,6 +120,18 @@ static void mark_factory_func(RGeo_FactoryData* data)
118
120
  if (!NIL_P(data->wkrep_wkb_generator)) {
119
121
  rb_gc_mark(data->wkrep_wkb_generator);
120
122
  }
123
+ if (!NIL_P(data->wkrep_wkt_parser)) {
124
+ rb_gc_mark(data->wkrep_wkt_parser);
125
+ }
126
+ if (!NIL_P(data->wkrep_wkb_parser)) {
127
+ rb_gc_mark(data->wkrep_wkb_parser);
128
+ }
129
+ if (!NIL_P(data->proj4_obj)) {
130
+ rb_gc_mark(data->proj4_obj);
131
+ }
132
+ if (!NIL_P(data->coord_sys_obj)) {
133
+ rb_gc_mark(data->coord_sys_obj);
134
+ }
121
135
  }
122
136
 
123
137
 
@@ -228,7 +242,7 @@ static VALUE method_factory_parse_wkb(VALUE self, VALUE str)
228
242
 
229
243
 
230
244
  static VALUE cmethod_factory_create(VALUE klass, VALUE flags, VALUE srid, VALUE buffer_resolution,
231
- VALUE wkt_generator, VALUE wkb_generator)
245
+ VALUE wkt_generator, VALUE wkb_generator, VALUE proj4_obj, VALUE coord_sys_obj)
232
246
  {
233
247
  VALUE result;
234
248
  RGeo_FactoryData* data;
@@ -252,6 +266,10 @@ static VALUE cmethod_factory_create(VALUE klass, VALUE flags, VALUE srid, VALUE
252
266
  data->wkb_writer = NULL;
253
267
  data->wkrep_wkt_generator = wkt_generator;
254
268
  data->wkrep_wkb_generator = wkb_generator;
269
+ data->wkrep_wkt_parser = Qnil;
270
+ data->wkrep_wkb_parser = Qnil;
271
+ data->proj4_obj = proj4_obj;
272
+ data->coord_sys_obj = coord_sys_obj;
255
273
  result = Data_Wrap_Struct(klass, mark_factory_func, destroy_factory_func, data);
256
274
  }
257
275
  else {
@@ -262,6 +280,109 @@ static VALUE cmethod_factory_create(VALUE klass, VALUE flags, VALUE srid, VALUE
262
280
  }
263
281
 
264
282
 
283
+ static VALUE alloc_factory(VALUE klass)
284
+ {
285
+ return cmethod_factory_create(klass, INT2NUM(0), INT2NUM(0), INT2NUM(0), Qnil, Qnil, Qnil, Qnil);
286
+ }
287
+
288
+
289
+ static VALUE method_factory_initialize_copy(VALUE self, VALUE orig)
290
+ {
291
+ RGeo_FactoryData* self_data;
292
+ RGeo_FactoryData* orig_data;
293
+ GEOSContextHandle_t context;
294
+
295
+ // Clear out existing data
296
+ self_data = RGEO_FACTORY_DATA_PTR(self);
297
+ context = self_data->geos_context;
298
+ if (self_data->wkt_reader) {
299
+ GEOSWKTReader_destroy_r(context, self_data->wkt_reader);
300
+ self_data->wkt_reader = NULL;
301
+ }
302
+ if (self_data->wkb_reader) {
303
+ GEOSWKBReader_destroy_r(context, self_data->wkb_reader);
304
+ self_data->wkb_reader = NULL;
305
+ }
306
+ if (self_data->wkt_writer) {
307
+ GEOSWKTWriter_destroy_r(context, self_data->wkt_writer);
308
+ self_data->wkt_writer = NULL;
309
+ }
310
+ if (self_data->wkb_writer) {
311
+ GEOSWKBWriter_destroy_r(context, self_data->wkb_writer);
312
+ self_data->wkb_writer = NULL;
313
+ }
314
+ self_data->wkrep_wkt_generator = Qnil;
315
+ self_data->wkrep_wkb_generator = Qnil;
316
+ self_data->wkrep_wkt_parser = Qnil;
317
+ self_data->wkrep_wkb_parser = Qnil;
318
+ self_data->proj4_obj = Qnil;
319
+ self_data->coord_sys_obj = Qnil;
320
+
321
+ // Copy new data from original object
322
+ if (TYPE(orig) == T_DATA && RDATA(orig)->dfree == (RUBY_DATA_FUNC)destroy_factory_func) {
323
+ orig_data = RGEO_FACTORY_DATA_PTR(orig);
324
+ self_data->flags = orig_data->flags;
325
+ self_data->srid = orig_data->srid;
326
+ self_data->buffer_resolution = orig_data->buffer_resolution;
327
+ self_data->wkrep_wkt_generator = orig_data->wkrep_wkt_generator;
328
+ self_data->wkrep_wkb_generator = orig_data->wkrep_wkb_generator;
329
+ self_data->wkrep_wkt_parser = orig_data->wkrep_wkt_parser;
330
+ self_data->wkrep_wkb_parser = orig_data->wkrep_wkb_parser;
331
+ self_data->proj4_obj = orig_data->proj4_obj;
332
+ self_data->coord_sys_obj = orig_data->coord_sys_obj;
333
+ }
334
+ return self;
335
+ }
336
+
337
+
338
+ static VALUE method_set_wkrep_parsers(VALUE self, VALUE wkt_parser, VALUE wkb_parser)
339
+ {
340
+ RGeo_FactoryData* self_data;
341
+
342
+ self_data = RGEO_FACTORY_DATA_PTR(self);
343
+ self_data->wkrep_wkt_parser = wkt_parser;
344
+ self_data->wkrep_wkb_parser = wkb_parser;
345
+
346
+ return self;
347
+ }
348
+
349
+
350
+ static VALUE method_get_proj4(VALUE self)
351
+ {
352
+ return RGEO_FACTORY_DATA_PTR(self)->proj4_obj;
353
+ }
354
+
355
+
356
+ static VALUE method_get_coord_sys(VALUE self)
357
+ {
358
+ return RGEO_FACTORY_DATA_PTR(self)->coord_sys_obj;
359
+ }
360
+
361
+
362
+ static VALUE method_get_wkt_generator(VALUE self)
363
+ {
364
+ return RGEO_FACTORY_DATA_PTR(self)->wkrep_wkt_generator;
365
+ }
366
+
367
+
368
+ static VALUE method_get_wkb_generator(VALUE self)
369
+ {
370
+ return RGEO_FACTORY_DATA_PTR(self)->wkrep_wkb_generator;
371
+ }
372
+
373
+
374
+ static VALUE method_get_wkt_parser(VALUE self)
375
+ {
376
+ return RGEO_FACTORY_DATA_PTR(self)->wkrep_wkt_parser;
377
+ }
378
+
379
+
380
+ static VALUE method_get_wkb_parser(VALUE self)
381
+ {
382
+ return RGEO_FACTORY_DATA_PTR(self)->wkrep_wkb_parser;
383
+ }
384
+
385
+
265
386
  /**** INITIALIZATION FUNCTION ****/
266
387
 
267
388
 
@@ -281,17 +402,27 @@ RGeo_Globals* rgeo_init_geos_factory()
281
402
  globals->id_cast = rb_intern("cast");
282
403
  globals->id_eql = rb_intern("eql?");
283
404
  globals->id_generate = rb_intern("generate");
405
+ globals->id_enum_for = rb_intern("enum_for");
284
406
  globals->sym_force_new = ID2SYM(rb_intern("force_new"));
285
407
  globals->sym_keep_subtype = ID2SYM(rb_intern("keep_subtype"));
286
408
 
287
409
  // Add C methods to the factory.
288
410
  geos_factory_class = rb_const_get_at(globals->geos_module, rb_intern("Factory"));
411
+ rb_define_alloc_func(geos_factory_class, alloc_factory);
412
+ rb_define_method(geos_factory_class, "initialize_copy", method_factory_initialize_copy, 1);
289
413
  rb_define_method(geos_factory_class, "_parse_wkt_impl", method_factory_parse_wkt, 1);
290
414
  rb_define_method(geos_factory_class, "_parse_wkb_impl", method_factory_parse_wkb, 1);
291
415
  rb_define_method(geos_factory_class, "_srid", method_factory_srid, 0);
292
416
  rb_define_method(geos_factory_class, "_buffer_resolution", method_factory_buffer_resolution, 0);
293
417
  rb_define_method(geos_factory_class, "_flags", method_factory_flags, 0);
294
- rb_define_module_function(geos_factory_class, "_create", cmethod_factory_create, 5);
418
+ rb_define_method(geos_factory_class, "_set_wkrep_parsers", method_set_wkrep_parsers, 2);
419
+ rb_define_method(geos_factory_class, "_proj4", method_get_proj4, 0);
420
+ rb_define_method(geos_factory_class, "_coord_sys", method_get_coord_sys, 0);
421
+ rb_define_method(geos_factory_class, "_wkt_generator", method_get_wkt_generator, 0);
422
+ rb_define_method(geos_factory_class, "_wkb_generator", method_get_wkb_generator, 0);
423
+ rb_define_method(geos_factory_class, "_wkt_parser", method_get_wkt_parser, 0);
424
+ rb_define_method(geos_factory_class, "_wkb_parser", method_get_wkb_parser, 0);
425
+ rb_define_module_function(geos_factory_class, "_create", cmethod_factory_create, 7);
295
426
 
296
427
  // Wrap the globals in a Ruby object and store it off so we have access
297
428
  // to it later. Each factory instance will reference it internally.
@@ -77,6 +77,7 @@ typedef struct {
77
77
  ID id_cast;
78
78
  ID id_eql;
79
79
  ID id_generate;
80
+ ID id_enum_for;
80
81
  VALUE sym_force_new;
81
82
  VALUE sym_keep_subtype;
82
83
  } RGeo_Globals;
@@ -98,6 +99,10 @@ typedef struct {
98
99
  GEOSWKBWriter* wkb_writer;
99
100
  VALUE wkrep_wkt_generator;
100
101
  VALUE wkrep_wkb_generator;
102
+ VALUE wkrep_wkt_parser;
103
+ VALUE wkrep_wkb_parser;
104
+ VALUE proj4_obj;
105
+ VALUE coord_sys_obj;
101
106
  int flags;
102
107
  int srid;
103
108
  int buffer_resolution;
@@ -262,22 +262,28 @@ static VALUE method_geometry_collection_each(VALUE self)
262
262
  const GEOSGeometry* elem_geom;
263
263
 
264
264
  self_data = RGEO_GEOMETRY_DATA_PTR(self);
265
- self_geom = self_data->geom;
266
- if (self_geom) {
267
- GEOSContextHandle_t self_context = self_data->geos_context;
268
- len = GEOSGetNumGeometries_r(self_context, self_geom);
269
- if (len > 0) {
270
- klasses = self_data->klasses;
271
- for (i=0; i<len; ++i) {
272
- elem_geom = GEOSGetGeometryN_r(self_context, self_geom, i);
273
- elem = rgeo_wrap_geos_geometry_clone(self_data->factory, elem_geom, NIL_P(klasses) ? Qnil : rb_ary_entry(klasses, i));
274
- if (!NIL_P(elem)) {
275
- rb_yield(elem);
265
+
266
+ if (rb_block_given_p()) {
267
+ self_geom = self_data->geom;
268
+ if (self_geom) {
269
+ GEOSContextHandle_t self_context = self_data->geos_context;
270
+ len = GEOSGetNumGeometries_r(self_context, self_geom);
271
+ if (len > 0) {
272
+ klasses = self_data->klasses;
273
+ for (i=0; i<len; ++i) {
274
+ elem_geom = GEOSGetGeometryN_r(self_context, self_geom, i);
275
+ elem = rgeo_wrap_geos_geometry_clone(self_data->factory, elem_geom, NIL_P(klasses) ? Qnil : rb_ary_entry(klasses, i));
276
+ if (!NIL_P(elem)) {
277
+ rb_yield(elem);
278
+ }
276
279
  }
277
280
  }
278
281
  }
282
+ return self;
283
+ }
284
+ else {
285
+ return rb_funcall(self, RGEO_FACTORY_DATA_PTR(self_data->factory)->globals->id_enum_for, 0);
279
286
  }
280
- return self;
281
287
  }
282
288
 
283
289
 
@@ -76,6 +76,7 @@ module RGeo
76
76
  end
77
77
  srid_ ||= @coord_sys.authority_code if @coord_sys
78
78
  @srid = srid_.to_i
79
+ @lenient_assertions = opts_[:uses_lenient_assertions] ? true : false
79
80
 
80
81
  wkt_generator_ = opts_[:wkt_generator]
81
82
  case wkt_generator_
@@ -127,6 +128,7 @@ module RGeo
127
128
  'wkbg' => @wkb_generator._properties,
128
129
  'wktp' => @wkt_parser._properties,
129
130
  'wkbp' => @wkb_parser._properties,
131
+ 'lena' => @lenient_assertions,
130
132
  }
131
133
  hash_['proj4'] = @proj4.marshal_dump if @proj4
132
134
  hash_['cs'] = @coord_sys.to_wkt if @coord_sys
@@ -145,22 +147,39 @@ module RGeo
145
147
  else
146
148
  coord_sys_ = nil
147
149
  end
148
- initialize({
150
+ initialize(
149
151
  :has_z_coordinate => data_['hasz'],
150
152
  :has_m_coordinate => data_['hasm'],
151
153
  :srid => data_['srid'],
152
- :wkt_generator => data_['wktg'],
153
- :wkb_generator => data_['wkbg'],
154
- :wkt_parser => data_['wktp'],
155
- :wkb_parser => data_['wkbp'],
154
+ :wkt_generator => ImplHelper::Utils.symbolize_hash(data_['wktg']),
155
+ :wkb_generator => ImplHelper::Utils.symbolize_hash(data_['wkbg']),
156
+ :wkt_parser => ImplHelper::Utils.symbolize_hash(data_['wktp']),
157
+ :wkb_parser => ImplHelper::Utils.symbolize_hash(data_['wkbp']),
158
+ :uses_lenient_assertions => data_['lena'],
156
159
  :proj4 => proj4_,
157
- :coord_sys => coord_sys_,
158
- })
160
+ :coord_sys => coord_sys_
161
+ )
159
162
  end
160
163
 
161
164
 
162
165
  # Psych support
163
166
 
167
+ def encode_with(coder_) # :nodoc:
168
+ coder_['has_z_coordinate'] = @has_z
169
+ coder_['has_m_coordinate'] = @has_m
170
+ coder_['srid'] = @srid
171
+ coder_['lenient_assertions'] = @lenient_assertions
172
+ coder_['wkt_generator'] = @wkt_generator._properties
173
+ coder_['wkb_generator'] = @wkb_generator._properties
174
+ coder_['wkt_parser'] = @wkt_parser._properties
175
+ coder_['wkb_parser'] = @wkb_parser._properties
176
+ if @proj4
177
+ str_ = @proj4.original_str || @proj4.canonical_str
178
+ coder_['proj4'] = @proj4.radians? ? {'proj4' => str_, 'radians' => true} : str_
179
+ end
180
+ coder_['coord_sys'] = @coord_sys.to_wkt if @coord_sys
181
+ end
182
+
164
183
  def init_with(coder_) # :nodoc:
165
184
  if (proj4_data_ = coder_['proj4'])
166
185
  if proj4_data_.is_a?(::Hash)
@@ -171,37 +190,23 @@ module RGeo
171
190
  else
172
191
  proj4_ = nil
173
192
  end
174
- if (coord_sys_data_ = data_['cs'])
193
+ if (coord_sys_data_ = coder_['cs'])
175
194
  coord_sys_ = CoordSys::CS.create_from_wkt(coord_sys_data_.to_s)
176
195
  else
177
196
  coord_sys_ = nil
178
197
  end
179
- initialize({
180
- :has_z_coordinate => data_['has_z_coordinate'],
181
- :has_m_coordinate => data_['has_m_coordinate'],
182
- :srid => data_['srid'],
183
- :wkt_generator => data_['wkt_generator'],
184
- :wkb_generator => data_['wkb_generator'],
185
- :wkt_parser => data_['wkt_parser'],
186
- :wkb_parser => data_['wkb_parser'],
198
+ initialize(
199
+ :has_z_coordinate => coder_['has_z_coordinate'],
200
+ :has_m_coordinate => coder_['has_m_coordinate'],
201
+ :srid => coder_['srid'],
202
+ :wkt_generator => ImplHelper::Utils.symbolize_hash(coder_['wkt_generator']),
203
+ :wkb_generator => ImplHelper::Utils.symbolize_hash(coder_['wkb_generator']),
204
+ :wkt_parser => ImplHelper::Utils.symbolize_hash(coder_['wkt_parser']),
205
+ :wkb_parser => ImplHelper::Utils.symbolize_hash(coder_['wkb_parser']),
206
+ :uses_lenient_assertions => coder_['lenient_assertions'],
187
207
  :proj4 => proj4_,
188
- :coord_sys => coord_sys_,
189
- })
190
- end
191
-
192
- def encode_with(coder_) # :nodoc:
193
- coder_['has_z_coordinate'] = @has_z
194
- coder_['has_m_coordinate'] = @has_m
195
- coder_['srid'] = @srid
196
- coder_['wkt_generator'] = @wkt_generator._properties
197
- coder_['wkb_generator'] = @wkb_generator._properties
198
- coder_['wkt_parser'] = @wkt_parser._properties
199
- coder_['wkb_parser'] = @wkb_parser._properties
200
- if @proj4
201
- str_ = @proj4.original_str || @proj4.canonical_str
202
- coder_['proj4'] = @proj4.radians? ? {'proj4' => str_, 'radians' => true} : str_
203
- end
204
- coder_['coord_sys'] = @coord_sys.to_wkt if @coord_sys
208
+ :coord_sys => coord_sys_
209
+ )
205
210
  end
206
211
 
207
212
 
@@ -220,6 +225,8 @@ module RGeo
220
225
  @has_z
221
226
  when :has_m_coordinate
222
227
  @has_m
228
+ when :uses_lenient_assertions
229
+ @lenient_assertions
223
230
  when :is_cartesian
224
231
  true
225
232
  else
@@ -111,6 +111,12 @@ module RGeo
111
111
  # Support a Z coordinate. Default is false.
112
112
  # [<tt>:has_m_coordinate</tt>]
113
113
  # Support an M coordinate. Default is false.
114
+ # [<tt>:uses_lenient_assertions</tt>]
115
+ # If set to true, assertion checking is disabled. This includes
116
+ # simplicity checking on LinearRing, and validity checks on
117
+ # Polygon and MultiPolygon. This may speed up creation of certain
118
+ # objects, at the expense of not doing the proper checking for
119
+ # OGC compliance. Default is false.
114
120
  # [<tt>:wkt_parser</tt>]
115
121
  # Configure the parser for WKT. The value is a hash of
116
122
  # configuration parameters for WKRep::WKTParser.new. Default is
@@ -242,6 +242,10 @@ module RGeo
242
242
 
243
243
  # Psych support
244
244
 
245
+ def encode_with(coder_) # :nodoc:
246
+ coder_['wkt'] = to_wkt
247
+ end
248
+
245
249
  def init_with(coder_) # :nodoc:
246
250
  temp_ = CS.create_from_wkt(coder_.type == :scalar ? coder_.scalar : coder_['wkt'] )
247
251
  if temp_.class == self.class
@@ -253,10 +257,6 @@ module RGeo
253
257
  end
254
258
  end
255
259
 
256
- def encode_with(coder_) # :nodoc:
257
- coder_['wkt'] = to_wkt
258
- end
259
-
260
260
 
261
261
  class << self
262
262
 
@@ -96,6 +96,11 @@ module RGeo
96
96
 
97
97
  # Psych support
98
98
 
99
+ def encode_with(coder_) # :nodoc:
100
+ coder_['proj4'] = original_str || canonical_str
101
+ coder_['radians'] = radians?
102
+ end
103
+
99
104
  def init_with(coder_) # :nodoc:
100
105
  if coder_.type == :scalar
101
106
  _set_value(coder_.scalar, false)
@@ -104,11 +109,6 @@ module RGeo
104
109
  end
105
110
  end
106
111
 
107
- def encode_with(coder_) # :nodoc:
108
- coder_['proj4'] = original_str || canonical_str
109
- coder_['radians'] = radians?
110
- end
111
-
112
112
 
113
113
  # Returns the "canonical" string definition for this coordinate
114
114
  # system, as reported by Proj4. This may be slightly different