Skip to content

Instantly share code, notes, and snippets.

@zackperdue
Created February 27, 2017 12:14
Show Gist options
  • Save zackperdue/43b352c620636b8db191325029cb73d2 to your computer and use it in GitHub Desktop.
Save zackperdue/43b352c620636b8db191325029cb73d2 to your computer and use it in GitHub Desktop.
postgis initializer for rails
RGeo::ActiveRecord::SpatialFactoryStore.instance.tap do |config|
# By default, use the GEOS implementation for spatial columns.
config.default = RGeo::Geos.factory_generator
# But use a geographic implementation for point columns.
config.register(RGeo::Geographic.spherical_factory(srid: 4326), geo_type: "point")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment