66
77This is the ** next-generation PostGIS adapter** that brings PostGIS support to Rails the right way:
88
9- ✅ ** Use standard ` postgres:// ` URLs** - No custom adapter names, no special configuration
10- ✅ ** No monkey patching** - Clean extensions using Rails 8 patterns
11- ✅ ** No obscure hacks** - Transparent, well-documented implementation
12- ✅ ** Latest APIs** - Built for Rails 8+ and Ruby 3.3+
13- ✅ ** Zero configuration** - Just add the gem and it works
9+ - ** Use standard ` postgres:// ` URLs** - No custom adapter names, no special configuration
10+ - ** No monkey patching** - Clean extensions using Rails 8.1 patterns
11+ - ** No obscure hacks** - Transparent, well-documented implementation
12+ - ** Latest APIs** - Built for Rails 8.1 + and Ruby 3.3+
13+ - ** Zero configuration** - Just add the gem and it works
1414
1515Unlike legacy PostGIS adapters that require custom database URLs, special configurations, and complex setup, this gem ** extends the existing PostgreSQL adapter** seamlessly. Your database configuration stays clean and standard.
1616
@@ -53,7 +53,7 @@ development:
5353Create spatial columns using PostGIS types:
5454
5555``` ruby
56- class CreateLocations < ActiveRecord ::Migration [8.0 ]
56+ class CreateLocations < ActiveRecord ::Migration [8.1 ]
5757 def change
5858 create_table :locations do |t |
5959 t.st_point :coordinates , srid: 4326
@@ -81,14 +81,14 @@ Location.where("ST_Distance(coordinates, ?) < ?", point, 1000)
8181
8282# Using parameterized queries (automatically quoted)
8383locations_nearby = Location .where(
84- " ST_DWithin(coordinates, ?, ?)" ,
85- point,
84+ " ST_DWithin(coordinates, ?, ?)" ,
85+ point,
8686 1000 # meters
8787)
8888
8989# Complex spatial queries
9090parks_in_city = Park .where(
91- " ST_Within(boundary, ?)" ,
91+ " ST_Within(boundary, ?)" ,
9292 city_polygon
9393)
9494```
@@ -186,28 +186,28 @@ class LocationTest < ActiveSupport::TestCase
186186 point1 = create_point(- 5.9 , 35.8 )
187187 point2 = create_point(- 5.91 , 35.81 )
188188 polygon = create_test_polygon
189-
189+
190190 location = Location .create!(coordinates: point1, boundary: polygon)
191-
191+
192192 # Traditional assertions
193193 assert_spatial_equal point1, location.coordinates
194194 assert_within_distance point1, point2, 200 # meters
195195 assert_contains polygon, point1
196-
196+
197197 # New chainable syntax (recommended)
198198 assert_spatial_column(location.coordinates)
199199 .has_srid(4326 )
200200 .is_type(:point )
201201 .is_geographic
202-
202+
203203 assert_spatial_column(location.boundary)
204204 .is_type(:polygon )
205205 .has_srid(4326 )
206206 end
207-
207+
208208 def test_3d_geometry
209209 point_3d = create_point(1.0 , 2.0 , srid: 4326 , z: 10.0 )
210-
210+
211211 assert_spatial_column(point_3d)
212212 .has_z
213213 .has_srid(4326 )
@@ -237,28 +237,26 @@ end
237237
238238** Geometry Factories:**
239239- ` create_point(x, y, srid: 4326) ` - Create test points
240- - ` create_test_polygon(srid: 4326) ` - Create test polygons
240+ - ` create_test_polygon(srid: 4326) ` - Create test polygons
241241- ` create_test_linestring(srid: 4326) ` - Create test linestrings
242242- ` factory(srid: 4326, geographic: false) ` - Get geometry factory
243243- ` geographic_factory(srid: 4326) ` - Get geographic factory
244244- ` cartesian_factory(srid: 0) ` - Get cartesian factory
245245
246246## Documentation
247247
248- 📚 ** Learn Like You're Defending the Galaxy**
249-
250- - [ 🚀 Spatial Warfare Manual] ( docs/SPATIAL_WARFARE.md ) - Advanced PostGIS arsenal explained through space combat
251- - [ 🍳 The PostGIS Cookbook] ( docs/COOKBOOK.md ) - Real-world recipes from delivery fleets to geofencing
248+ - [ Spatial Warfare Manual] ( docs/SPATIAL_WARFARE.md ) - Advanced PostGIS arsenal explained through space combat
249+ - [ The PostGIS Cookbook] ( docs/COOKBOOK.md ) - Real-world recipes from delivery fleets to geofencing
252250
253251## Features
254252
255- 🌍 ** Complete PostGIS Type Support**
256- - ` st_point ` , ` st_line_string ` , ` st_polygon `
253+ ** Complete PostGIS Type Support**
254+ - ` st_point ` , ` st_line_string ` , ` st_polygon `
257255- ` st_multi_point ` , ` st_multi_line_string ` , ` st_multi_polygon `
258256- ` st_geometry_collection ` , ` st_geography `
259257- Support for SRID, Z/M dimensions
260258
261- 🔍 ** Spatial Query Methods**
259+ ** Spatial Query Methods**
262260- Core methods: ` st_distance ` , ` st_contains ` , ` st_within ` , ` st_length `
263261- ** NEW:** Advanced spatial operations:
264262 - ` <-> ` (distance_operator) - K-Nearest Neighbor search (blazing fast!)
@@ -270,13 +268,13 @@ end
270268- Custom Arel visitor for PostGIS SQL generation
271269- Seamless integration with ActiveRecord queries
272270
273- ⚡ ** Modern Architecture**
274- - Built on Rails 8 patterns
271+ ** Modern Architecture**
272+ - Built on Rails 8.1 patterns
275273- Clean module extensions (no inheritance)
276274- Proper type registration and schema dumping
277275- Compatible with multi-database setups
278276
279- 🛠️ ** Developer Experience**
277+ ** Developer Experience**
280278- Standard ` postgres:// ` URLs
281279- Works with existing PostgreSQL tools
282280- Clear error messages and debugging
@@ -287,17 +285,17 @@ end
287285
288286This gem builds upon the incredible work of many contributors to the Ruby geospatial ecosystem:
289287
290- 🙏 ** RGeo Ecosystem** - The foundation that makes Ruby geospatial possible:
288+ ** RGeo Ecosystem** - The foundation that makes Ruby geospatial possible:
291289- [ RGeo] ( https://github.com/rgeo/rgeo ) originally by Daniel Azuma, currently maintained by Keith Doggett (@keithdoggett ) and Ulysse Buonomo (@BuonOmo )
292290- [ RGeo::ActiveRecord] ( https://github.com/rgeo/rgeo-activerecord ) for ActiveRecord integration
293291- [ RGeo::Proj4] ( https://github.com/rgeo/rgeo-proj4 ) for coordinate system transformations
294292- Former maintainer Tee Parham and all contributors who built this ecosystem
295293
296- 🗺️ ** PostGIS Pioneers** - Previous PostGIS adapters that paved the way:
294+ ** PostGIS Pioneers** - Previous PostGIS adapters that paved the way:
297295- [ activerecord-postgis-adapter] ( https://github.com/rgeo/activerecord-postgis-adapter ) by Daniel Azuma and the RGeo team
298296- All the maintainers and contributors who solved spatial data challenges in Rails
299297
300- 🌍 ** PostGIS & GEOS** - The underlying spatial powerhouses:
298+ ** PostGIS & GEOS** - The underlying spatial powerhouses:
301299- PostGIS developers for the amazing spatial database extension
302300- GEOS contributors for computational geometry
303301- PostgreSQL team for the solid foundation
0 commit comments