Module: RGeo::ImplHelper::Utils
- Included in:
- Cartesian::Factory, Geographic::Factory, Geos::CAPIFactory, Geos::FFIFactory, Geos::ZMFactory
- Defined in:
- lib/rgeo/impl_helper/utils.rb
Overview
:nodoc:
Class Method Summary collapse
-
.setup_coord_sys(srid, coord_sys, coord_sys_class) ⇒ Object
Helper function to create coord_sys from common options in most factories.
Class Method Details
.setup_coord_sys(srid, coord_sys, coord_sys_class) ⇒ Object
Helper function to create coord_sys from common options in most factories. Returns a hash with finalized coord sys info after processing.
The reason we return the data as a hash instead of assigning instance variables is because some classes need to do this multiple times with different values and others pass the data to a CAPI or FFI.
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/rgeo/impl_helper/utils.rb', line 20 def self.setup_coord_sys(srid, coord_sys, coord_sys_class) coord_sys_class = CoordSys::CONFIG.default_coord_sys_class unless coord_sys_class.is_a?(Class) coord_sys = coord_sys_class.create_from_wkt(coord_sys) if coord_sys.is_a?(String) srid ||= coord_sys. if coord_sys srid = srid.to_i # Create a coord sys based on the SRID if one was not given coord_sys = coord_sys_class.create(srid) if coord_sys.nil? && srid != 0 { coord_sys:, srid: } end |