Module: PostgresExt::Postgis::ActiveRecord::ConnectionAdapters::PostgreSQLColumn::ClassMethods
- Defined in:
- lib/postgres_ext/postgis/active_record/connection_adapters.rb
Instance Method Summary collapse
- #geometry_to_string(value) ⇒ Object
- #string_to_geometry(value) ⇒ Object
- #wkb_generator ⇒ Object
- #wkb_parser ⇒ Object
- #wkt_parser ⇒ Object
Instance Method Details
#geometry_to_string(value) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/postgres_ext/postgis/active_record/connection_adapters.rb', line 33 def geometry_to_string(value) if RGeo::Feature::Instance wkb_generator.generate value else value end end |
#string_to_geometry(value) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/postgres_ext/postgis/active_record/connection_adapters.rb', line 25 def string_to_geometry(value) if value.index('(') wkt_parser.parse value else wkb_parser.parse value end end |
#wkb_generator ⇒ Object
17 18 19 |
# File 'lib/postgres_ext/postgis/active_record/connection_adapters.rb', line 17 def wkb_generator @wkb_generator ||= RGeo::WKRep::WKBGenerator.new hex_format: true, type_format: :ewkb, emit_ewkb_srid: true end |
#wkb_parser ⇒ Object
13 14 15 |
# File 'lib/postgres_ext/postgis/active_record/connection_adapters.rb', line 13 def wkb_parser @wkb_parser ||= RGeo::WKRep::WKBParser.new nil, support_ewkb: true end |
#wkt_parser ⇒ Object
21 22 23 |
# File 'lib/postgres_ext/postgis/active_record/connection_adapters.rb', line 21 def wkt_parser @wkt_parser ||= RGeo::WKRep::WKTParser.new nil, support_ewkt: true end |