Module: ActiveRecord::ConnectionAdapters::PostGIS::ColumnDefinitionUtils
- Defined in:
- lib/active_record/connection_adapters/postgis/spatial_table_definition.rb
Class Method Summary collapse
- .default_srid(options) ⇒ Object
- .geo_type(type = "GEOMETRY") ⇒ Object
- .limit_from_options(type, options = {}) ⇒ Object
Class Method Details
.default_srid(options) ⇒ Object
53 54 55 |
# File 'lib/active_record/connection_adapters/postgis/spatial_table_definition.rb', line 53 def default_srid() [:geographic] ? 4326 : PostGISAdapter::DEFAULT_SRID end |
.geo_type(type = "GEOMETRY") ⇒ Object
38 39 40 41 42 43 |
# File 'lib/active_record/connection_adapters/postgis/spatial_table_definition.rb', line 38 def geo_type(type = "GEOMETRY") g_type = type.to_s.delete("_").upcase return "POINT" if g_type == "STPOINT" return "POLYGON" if g_type == "STPOLYGON" g_type end |
.limit_from_options(type, options = {}) ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/active_record/connection_adapters/postgis/spatial_table_definition.rb', line 45 def (type, = {}) has_z = [:has_z] ? 'Z' : '' has_m = [:has_m] ? 'M' : '' srid = [:srid] || default_srid() field_type = [geo_type(type), has_z, has_m].compact.join "#{field_type},#{srid}" end |