Module: ActiveRecordSpatial
- Defined in:
- lib/activerecord-spatial.rb,
lib/activerecord-spatial/version.rb,
lib/activerecord-spatial/active_record.rb,
lib/activerecord-spatial/spatial_scopes.rb,
lib/activerecord-spatial/spatial_columns.rb,
lib/activerecord-spatial/spatial_function.rb,
lib/activerecord-spatial/spatial_scope_constants.rb,
lib/activerecord-spatial/active_record/models/spatial_column.rb,
lib/activerecord-spatial/active_record/models/geometry_column.rb,
lib/activerecord-spatial/active_record/models/spatial_ref_sys.rb,
lib/activerecord-spatial/active_record/models/geography_column.rb,
lib/activerecord-spatial/active_record/connection_adapters/postgresql/postgis.rb,
lib/activerecord-spatial/active_record/connection_adapters/postgresql/unknown_srid.rb,
lib/activerecord-spatial/active_record/connection_adapters/postgresql/adapter_extensions.rb
Defined Under Namespace
Modules: Associations, SpatialColumn, SpatialColumns, SpatialScopeConstants, SpatialScopes Classes: GeographyColumn, GeometryColumn, SpatialFunction, SpatialRefSys
Constant Summary collapse
- BASE_PATH =
File.dirname(__FILE__)
- VERSION =
'0.0.1'- GeospatialScopes =
Alias for backwards compatibility.
SpatialScopes- GeometryColumns =
Alias for backwards compatibility.
SpatialColumns- POSTGIS =
begin if (version_string = ::ActiveRecord::Base.connection.select_rows("SELECT postgis_full_version()").flatten.first).present? hash = { :use_stats => version_string =~ /USE_STATS/ } { :lib => /POSTGIS="([^"]+)"/, :geos => /GEOS="([^"]+)"/, :proj => /PROJ="([^"]+)"/, :libxml => /LIBXML="([^"]+)"/ }.each do |k, v| hash[k] = version_string.scan(v).flatten.first end hash.freeze else {}.freeze end end
- UNKNOWN_SRIDS =
begin if ActiveRecordSpatial::POSTGIS[:lib] >= '2.0' { :geography => 0, :geometry => 0 }.freeze else { :geography => 0, :geometry => -1 }.freeze end end
- UNKNOWN_SRID =
begin ActiveRecordSpatial::UNKNOWN_SRIDS[:geometry] end
Class Method Summary collapse
- .default_column_name ⇒ Object
-
.default_column_name=(column_name) ⇒ Object
Allows you to modify the default geometry column name for all of ActiveRecordSpatial.
- .geography_columns? ⇒ Boolean
- .geometry_columns? ⇒ Boolean
Class Method Details
.default_column_name ⇒ Object
18 19 20 |
# File 'lib/activerecord-spatial.rb', line 18 def default_column_name @default_column_name ||= :the_geom end |
.default_column_name=(column_name) ⇒ Object
Allows you to modify the default geometry column name for all of ActiveRecordSpatial. This is useful when you have a common column name for all of your geometry columns, such as wkb, feature, geom, etc.
25 26 27 |
# File 'lib/activerecord-spatial.rb', line 25 def default_column_name=(column_name) @default_column_name = column_name end |
.geography_columns? ⇒ Boolean
14 15 16 |
# File 'lib/activerecord-spatial.rb', line 14 def geography_columns? ::ActiveRecord::Base.connection.geography_columns? end |
.geometry_columns? ⇒ Boolean
10 11 12 |
# File 'lib/activerecord-spatial.rb', line 10 def geometry_columns? ::ActiveRecord::Base.connection.geometry_columns? end |