Module: ActiveRecordSpatial::SpatialColumns::ClassMethods
- Defined in:
- lib/activerecord-spatial/spatial_columns.rb
Instance Method Summary collapse
-
#coord_dimension_for(column_name) ⇒ Object
Quickly grab the number of dimensions for a geometry column.
-
#geography_column_by_name(name) ⇒ Object
Grabs a geography column based on name.
-
#geography_columns ⇒ Object
Returns an Array of available geography columns in the table.
-
#geography_columns! ⇒ Object
Force a reload of available geography columns.
-
#geometry_column_by_name(name) ⇒ Object
Grabs a geometry column based on name.
-
#geometry_columns ⇒ Object
Returns an Array of available geometry columns in the table.
-
#geometry_columns! ⇒ Object
Force a reload of available geometry columns.
-
#spatial_column_by_name(name) ⇒ Object
Grabs a spatial column based on name.
-
#spatial_columns ⇒ Object
Returns both the geometry and geography columns for a table.
-
#spatial_columns! ⇒ Object
Reloads both the geometry and geography columns for a table.
-
#spatial_function(*args) ⇒ Object
Build call to ActiveRecordSpatial::SpatialFunction.build! that helps you create spatial function calls.
-
#srid_for(column_name) ⇒ Object
Quickly grab the SRID for a geometry column.
Instance Method Details
#coord_dimension_for(column_name) ⇒ Object
Quickly grab the number of dimensions for a geometry column.
126 127 128 |
# File 'lib/activerecord-spatial/spatial_columns.rb', line 126 def coord_dimension_for(column_name) spatial_column_by_name(column_name).coord_dimension end |
#geography_column_by_name(name) ⇒ Object
Grabs a geography column based on name.
72 |
# File 'lib/activerecord-spatial/spatial_columns.rb', line 72 def geography_column_by_name(name); end |
#geography_columns ⇒ Object
Returns an Array of available geography columns in the table. These are PostgreSQLColumns with values set for the srid and coord_dimensions properties.
60 |
# File 'lib/activerecord-spatial/spatial_columns.rb', line 60 def geography_columns; end |
#geography_columns! ⇒ Object
Force a reload of available geography columns.
66 |
# File 'lib/activerecord-spatial/spatial_columns.rb', line 66 def geography_columns!; end |
#geometry_column_by_name(name) ⇒ Object
Grabs a geometry column based on name.
69 |
# File 'lib/activerecord-spatial/spatial_columns.rb', line 69 def geometry_column_by_name(name); end |
#geometry_columns ⇒ Object
Returns an Array of available geometry columns in the table. These are PostgreSQLColumns with values set for the srid and coord_dimensions properties.
55 |
# File 'lib/activerecord-spatial/spatial_columns.rb', line 55 def geometry_columns; end |
#geometry_columns! ⇒ Object
Force a reload of available geometry columns.
63 |
# File 'lib/activerecord-spatial/spatial_columns.rb', line 63 def geometry_columns!; end |
#spatial_column_by_name(name) ⇒ Object
Grabs a spatial column based on name.
85 86 87 |
# File 'lib/activerecord-spatial/spatial_columns.rb', line 85 def spatial_column_by_name(name) geometry_column_by_name(name) || geography_column_by_name(name) end |
#spatial_columns ⇒ Object
Returns both the geometry and geography columns for a table.
75 76 77 |
# File 'lib/activerecord-spatial/spatial_columns.rb', line 75 def spatial_columns geometry_columns + geography_columns end |
#spatial_columns! ⇒ Object
Reloads both the geometry and geography columns for a table.
80 81 82 |
# File 'lib/activerecord-spatial/spatial_columns.rb', line 80 def spatial_columns! geometry_columns! + geography_columns! end |
#spatial_function(*args) ⇒ Object
Build call to ActiveRecordSpatial::SpatialFunction.build! that helps you create spatial function calls.
46 47 48 |
# File 'lib/activerecord-spatial/spatial_columns.rb', line 46 def spatial_function(*args) SpatialFunction.build!(self, *args) end |
#srid_for(column_name) ⇒ Object
Quickly grab the SRID for a geometry column.
120 121 122 123 |
# File 'lib/activerecord-spatial/spatial_columns.rb', line 120 def srid_for(column_name) column = spatial_column_by_name(column_name) column.try(:srid) || ActiveRecordSpatial::UNKNOWN_SRID end |