activerecord-postgis 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +27 -29
- data/activerecord-postgis.gemspec +3 -2
- data/lib/active_record/connection_adapters/postgis/railtie.rb +13 -0
- data/lib/active_record/connection_adapters/postgis/version.rb +1 -1
- data/lib/active_record/connection_adapters/postgis.rb +80 -85
- data/lib/activerecord-postgis.rb +2 -0
- metadata +22 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 86b0a720bdf3520ba032d20033a4259e1875bd37ec97e9e517b0b1b1ac647e40
|
|
4
|
+
data.tar.gz: 4c2ff56e23a305ad149fb61b9f84d8742675e62358f80c4cd8708a488c7b3f67
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1a3849e3b5f56491964affeaac36f53317bc6fe1d77557067171b00197b0af5675b5aa090250efe9d083f51bf94e531b2965ed97802e704f4969e3e840cf4485
|
|
7
|
+
data.tar.gz: a4d2916514e25e89fd722567cddd90fe96bbda946c3de5c110018f6d20ad2b3e395049a5c4960bec1d565d03824340b22ed7c8f1bce92f3bbad4f5e6c1fabbba
|
data/README.md
CHANGED
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
This is the **next-generation PostGIS adapter** that brings PostGIS support to Rails the right way:
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
|
14
14
|
|
|
15
15
|
Unlike 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.
|
|
16
16
|
|
|
@@ -53,7 +53,7 @@ development:
|
|
|
53
53
|
Create spatial columns using PostGIS types:
|
|
54
54
|
|
|
55
55
|
```ruby
|
|
56
|
-
class CreateLocations < ActiveRecord::Migration[8.
|
|
56
|
+
class CreateLocations < ActiveRecord::Migration[8.1]
|
|
57
57
|
def change
|
|
58
58
|
create_table :locations do |t|
|
|
59
59
|
t.st_point :coordinates, srid: 4326
|
|
@@ -81,14 +81,14 @@ Location.where("ST_Distance(coordinates, ?) < ?", point, 1000)
|
|
|
81
81
|
|
|
82
82
|
# Using parameterized queries (automatically quoted)
|
|
83
83
|
locations_nearby = Location.where(
|
|
84
|
-
"ST_DWithin(coordinates, ?, ?)",
|
|
85
|
-
point,
|
|
84
|
+
"ST_DWithin(coordinates, ?, ?)",
|
|
85
|
+
point,
|
|
86
86
|
1000 # meters
|
|
87
87
|
)
|
|
88
88
|
|
|
89
89
|
# Complex spatial queries
|
|
90
90
|
parks_in_city = Park.where(
|
|
91
|
-
"ST_Within(boundary, ?)",
|
|
91
|
+
"ST_Within(boundary, ?)",
|
|
92
92
|
city_polygon
|
|
93
93
|
)
|
|
94
94
|
```
|
|
@@ -186,28 +186,28 @@ class LocationTest < ActiveSupport::TestCase
|
|
|
186
186
|
point1 = create_point(-5.9, 35.8)
|
|
187
187
|
point2 = create_point(-5.91, 35.81)
|
|
188
188
|
polygon = create_test_polygon
|
|
189
|
-
|
|
189
|
+
|
|
190
190
|
location = Location.create!(coordinates: point1, boundary: polygon)
|
|
191
|
-
|
|
191
|
+
|
|
192
192
|
# Traditional assertions
|
|
193
193
|
assert_spatial_equal point1, location.coordinates
|
|
194
194
|
assert_within_distance point1, point2, 200 # meters
|
|
195
195
|
assert_contains polygon, point1
|
|
196
|
-
|
|
196
|
+
|
|
197
197
|
# New chainable syntax (recommended)
|
|
198
198
|
assert_spatial_column(location.coordinates)
|
|
199
199
|
.has_srid(4326)
|
|
200
200
|
.is_type(:point)
|
|
201
201
|
.is_geographic
|
|
202
|
-
|
|
202
|
+
|
|
203
203
|
assert_spatial_column(location.boundary)
|
|
204
204
|
.is_type(:polygon)
|
|
205
205
|
.has_srid(4326)
|
|
206
206
|
end
|
|
207
|
-
|
|
207
|
+
|
|
208
208
|
def test_3d_geometry
|
|
209
209
|
point_3d = create_point(1.0, 2.0, srid: 4326, z: 10.0)
|
|
210
|
-
|
|
210
|
+
|
|
211
211
|
assert_spatial_column(point_3d)
|
|
212
212
|
.has_z
|
|
213
213
|
.has_srid(4326)
|
|
@@ -237,7 +237,7 @@ end
|
|
|
237
237
|
|
|
238
238
|
**Geometry Factories:**
|
|
239
239
|
- `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
|
|
241
241
|
- `create_test_linestring(srid: 4326)` - Create test linestrings
|
|
242
242
|
- `factory(srid: 4326, geographic: false)` - Get geometry factory
|
|
243
243
|
- `geographic_factory(srid: 4326)` - Get geographic factory
|
|
@@ -245,20 +245,18 @@ end
|
|
|
245
245
|
|
|
246
246
|
## Documentation
|
|
247
247
|
|
|
248
|
-
|
|
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
|
|
252
250
|
|
|
253
251
|
## Features
|
|
254
252
|
|
|
255
|
-
|
|
256
|
-
- `st_point`, `st_line_string`, `st_polygon`
|
|
253
|
+
**Complete PostGIS Type Support**
|
|
254
|
+
- `st_point`, `st_line_string`, `st_polygon`
|
|
257
255
|
- `st_multi_point`, `st_multi_line_string`, `st_multi_polygon`
|
|
258
256
|
- `st_geometry_collection`, `st_geography`
|
|
259
257
|
- Support for SRID, Z/M dimensions
|
|
260
258
|
|
|
261
|
-
|
|
259
|
+
**Spatial Query Methods**
|
|
262
260
|
- Core methods: `st_distance`, `st_contains`, `st_within`, `st_length`
|
|
263
261
|
- **NEW:** Advanced spatial operations:
|
|
264
262
|
- `<->` (distance_operator) - K-Nearest Neighbor search (blazing fast!)
|
|
@@ -270,13 +268,13 @@ end
|
|
|
270
268
|
- Custom Arel visitor for PostGIS SQL generation
|
|
271
269
|
- Seamless integration with ActiveRecord queries
|
|
272
270
|
|
|
273
|
-
|
|
274
|
-
- Built on Rails 8 patterns
|
|
271
|
+
**Modern Architecture**
|
|
272
|
+
- Built on Rails 8.1 patterns
|
|
275
273
|
- Clean module extensions (no inheritance)
|
|
276
274
|
- Proper type registration and schema dumping
|
|
277
275
|
- Compatible with multi-database setups
|
|
278
276
|
|
|
279
|
-
|
|
277
|
+
**Developer Experience**
|
|
280
278
|
- Standard `postgres://` URLs
|
|
281
279
|
- Works with existing PostgreSQL tools
|
|
282
280
|
- Clear error messages and debugging
|
|
@@ -287,17 +285,17 @@ end
|
|
|
287
285
|
|
|
288
286
|
This gem builds upon the incredible work of many contributors to the Ruby geospatial ecosystem:
|
|
289
287
|
|
|
290
|
-
|
|
288
|
+
**RGeo Ecosystem** - The foundation that makes Ruby geospatial possible:
|
|
291
289
|
- [RGeo](https://github.com/rgeo/rgeo) originally by Daniel Azuma, currently maintained by Keith Doggett (@keithdoggett) and Ulysse Buonomo (@BuonOmo)
|
|
292
290
|
- [RGeo::ActiveRecord](https://github.com/rgeo/rgeo-activerecord) for ActiveRecord integration
|
|
293
291
|
- [RGeo::Proj4](https://github.com/rgeo/rgeo-proj4) for coordinate system transformations
|
|
294
292
|
- Former maintainer Tee Parham and all contributors who built this ecosystem
|
|
295
293
|
|
|
296
|
-
|
|
294
|
+
**PostGIS Pioneers** - Previous PostGIS adapters that paved the way:
|
|
297
295
|
- [activerecord-postgis-adapter](https://github.com/rgeo/activerecord-postgis-adapter) by Daniel Azuma and the RGeo team
|
|
298
296
|
- All the maintainers and contributors who solved spatial data challenges in Rails
|
|
299
297
|
|
|
300
|
-
|
|
298
|
+
**PostGIS & GEOS** - The underlying spatial powerhouses:
|
|
301
299
|
- PostGIS developers for the amazing spatial database extension
|
|
302
300
|
- GEOS contributors for computational geometry
|
|
303
301
|
- PostgreSQL team for the solid foundation
|
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
|
12
12
|
spec.description = spec.summary
|
|
13
13
|
spec.homepage = 'https://github.com/seuros/activerecord-postgis'
|
|
14
14
|
spec.license = 'MIT'
|
|
15
|
-
spec.required_ruby_version = '>= 3.3.0'
|
|
15
|
+
spec.required_ruby_version = '>= 3.3.0', '< 5.0'
|
|
16
16
|
|
|
17
17
|
spec.metadata['homepage_uri'] = spec.homepage
|
|
18
18
|
spec.metadata['source_code_uri'] = spec.homepage
|
|
@@ -22,7 +22,8 @@ Gem::Specification.new do |spec|
|
|
|
22
22
|
spec.files = Dir.glob('{lib}/**/*') + [ gemspec, 'LICENSE.txt', 'README.md' ]
|
|
23
23
|
spec.require_paths = [ 'lib' ]
|
|
24
24
|
|
|
25
|
-
spec.add_dependency 'activerecord', '>= 8.1.0', '< 8.
|
|
25
|
+
spec.add_dependency 'activerecord', '>= 8.1.0', '< 8.3'
|
|
26
26
|
spec.add_dependency 'pg'
|
|
27
|
+
spec.add_dependency 'rgeo', '>= 3.1.0'
|
|
27
28
|
spec.add_dependency 'rgeo-activerecord', '>= 8.0'
|
|
28
29
|
end
|
|
@@ -35,26 +35,43 @@ module ActiveRecord
|
|
|
35
35
|
|
|
36
36
|
SPATIAL_OPTIONS_FOR_REGISTRATION = %i[srid has_z has_m geographic].freeze
|
|
37
37
|
|
|
38
|
+
POSTGIS_SYSTEM_TABLES = %w[
|
|
39
|
+
geography_columns
|
|
40
|
+
geometry_columns
|
|
41
|
+
layer
|
|
42
|
+
raster_columns
|
|
43
|
+
raster_overviews
|
|
44
|
+
spatial_ref_sys
|
|
45
|
+
topology
|
|
46
|
+
].freeze
|
|
47
|
+
|
|
38
48
|
def self.initialize!
|
|
39
49
|
return if @initialized
|
|
40
50
|
@initialized = true
|
|
41
51
|
|
|
42
|
-
|
|
43
|
-
PostgreSQL::Column.include(ColumnExtensions)
|
|
52
|
+
extend_postgresql_adapter
|
|
44
53
|
|
|
45
|
-
|
|
46
|
-
|
|
54
|
+
register_spatial_types
|
|
55
|
+
|
|
56
|
+
ignore_postgis_system_tables
|
|
57
|
+
end
|
|
47
58
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
59
|
+
def self.extend_postgresql_adapter
|
|
60
|
+
PostgreSQL::Column.include(ColumnExtensions)
|
|
61
|
+
PostgreSQLAdapter.prepend(Quoting)
|
|
62
|
+
PostgreSQL::Table.include(PostGIS::TableDefinition)
|
|
63
|
+
PostgreSQLAdapter.prepend(AdapterExtensions)
|
|
64
|
+
PostgreSQLAdapter.prepend(DatabaseStatements)
|
|
65
|
+
end
|
|
52
66
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
67
|
+
def self.register_spatial_types
|
|
68
|
+
register_native_database_types
|
|
69
|
+
register_column_methods
|
|
70
|
+
register_type_classes
|
|
71
|
+
register_type_mapping
|
|
72
|
+
end
|
|
56
73
|
|
|
57
|
-
|
|
74
|
+
def self.register_native_database_types
|
|
58
75
|
PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:st_geography] = { name: "geography" }
|
|
59
76
|
PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:st_geometry] = { name: "geometry" }
|
|
60
77
|
PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:st_geometry_collection] = { name: "geometry(GeometryCollection)" }
|
|
@@ -65,7 +82,6 @@ module ActiveRecord
|
|
|
65
82
|
PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:st_point] = { name: "geometry(Point)" }
|
|
66
83
|
PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:st_polygon] = { name: "geometry(Polygon)" }
|
|
67
84
|
|
|
68
|
-
# Legacy aliases for compatibility with activerecord-postgis-adapter
|
|
69
85
|
PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:geography] = { name: "geography" }
|
|
70
86
|
PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:geometry] = { name: "geometry" }
|
|
71
87
|
PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:geometry_collection] = { name: "geometry(GeometryCollection)" }
|
|
@@ -74,95 +90,69 @@ module ActiveRecord
|
|
|
74
90
|
PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:multi_point] = { name: "geometry(MultiPoint)" }
|
|
75
91
|
PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:multi_polygon] = { name: "geometry(MultiPolygon)" }
|
|
76
92
|
PostgreSQLAdapter::NATIVE_DATABASE_TYPES[:polygon] = { name: "geometry(Polygon)" }
|
|
93
|
+
end
|
|
77
94
|
|
|
78
|
-
|
|
79
|
-
# Tell Rails these are valid column methods for schema dumping - PostgreSQL only
|
|
95
|
+
def self.register_column_methods
|
|
80
96
|
PostgreSQL::TableDefinition.send(:define_column_methods,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
# prevent unknown OID warning and register PostGIS types
|
|
89
|
-
PostgreSQLAdapter.singleton_class.prepend(RegisterTypes)
|
|
90
|
-
|
|
91
|
-
# Prepend our extensions to handle spatial columns
|
|
92
|
-
PostgreSQLAdapter.prepend(AdapterExtensions)
|
|
93
|
-
|
|
94
|
-
# Prevent spatial_reference_sys truncation
|
|
95
|
-
PostgreSQLAdapter.prepend(DatabaseStatements)
|
|
97
|
+
:st_geography, :st_geometry, :st_geometry_collection, :st_line_string,
|
|
98
|
+
:st_multi_line_string, :st_multi_point, :st_multi_polygon, :st_point, :st_polygon,
|
|
99
|
+
:geography, :geometry, :geometry_collection, :line_string,
|
|
100
|
+
:multi_line_string, :multi_point, :multi_polygon, :polygon,
|
|
101
|
+
*SPATIAL_OPTIONS_FOR_REGISTRATION)
|
|
102
|
+
end
|
|
96
103
|
|
|
97
|
-
|
|
104
|
+
def self.register_type_classes
|
|
98
105
|
adapter_name = :postgresql
|
|
99
106
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
ActiveRecord::Type.register(:st_multi_polygon, Type::MultiPolygon, adapter: adapter_name)
|
|
108
|
-
ActiveRecord::Type.register(:st_point, Type::Point, adapter: adapter_name)
|
|
109
|
-
ActiveRecord::Type.register(:st_polygon, Type::Polygon, adapter: adapter_name)
|
|
110
|
-
|
|
111
|
-
# Legacy type registrations for compatibility with activerecord-postgis-adapter
|
|
112
|
-
ActiveRecord::Type.register(:geography, Type::Geography, adapter: adapter_name)
|
|
113
|
-
ActiveRecord::Type.register(:geometry, Type::Geometry, adapter: adapter_name)
|
|
114
|
-
ActiveRecord::Type.register(:geometry_collection, Type::GeometryCollection, adapter: adapter_name)
|
|
115
|
-
ActiveRecord::Type.register(:line_string, Type::LineString, adapter: adapter_name)
|
|
116
|
-
ActiveRecord::Type.register(:multi_line_string, Type::MultiLineString, adapter: adapter_name)
|
|
117
|
-
ActiveRecord::Type.register(:multi_point, Type::MultiPoint, adapter: adapter_name)
|
|
118
|
-
ActiveRecord::Type.register(:multi_polygon, Type::MultiPolygon, adapter: adapter_name)
|
|
119
|
-
ActiveRecord::Type.register(:polygon, Type::Polygon, adapter: adapter_name)
|
|
120
|
-
|
|
121
|
-
# Ignore PostGIS system tables in schema dumps - PostgreSQL specific
|
|
122
|
-
PostgreSQL::SchemaDumper.ignore_tables |= %w[
|
|
123
|
-
geography_columns
|
|
124
|
-
geometry_columns
|
|
125
|
-
layer
|
|
126
|
-
raster_columns
|
|
127
|
-
raster_overviews
|
|
128
|
-
spatial_ref_sys
|
|
129
|
-
topology
|
|
130
|
-
]
|
|
107
|
+
SPATIAL_TYPES_FOR_REGISTRATION.each do |type_name|
|
|
108
|
+
type_class_name = type_name.to_s.sub(/^st_/, "").split("_").map(&:capitalize).join
|
|
109
|
+
type_class = Type.const_get(type_class_name) rescue nil
|
|
110
|
+
if type_class
|
|
111
|
+
ActiveRecord::Type.register(type_name, type_class, adapter: adapter_name)
|
|
112
|
+
end
|
|
113
|
+
end
|
|
131
114
|
end
|
|
132
115
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
116
|
+
def self.register_type_mapping
|
|
117
|
+
if PostgreSQLAdapter.respond_to?(:register_type_mapping)
|
|
118
|
+
PostgreSQLAdapter.register_type_mapping { |m| TypeRegistration.register!(m) }
|
|
119
|
+
else
|
|
120
|
+
PostgreSQLAdapter.singleton_class.prepend(RegisterTypes)
|
|
121
|
+
end
|
|
122
|
+
end
|
|
136
123
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
124
|
+
def self.schema_ignored_tables
|
|
125
|
+
if ActiveRecord.respond_to?(:schema_ignored_tables)
|
|
126
|
+
ActiveRecord.schema_ignored_tables
|
|
127
|
+
else
|
|
128
|
+
PostgreSQL::SchemaDumper.ignore_tables
|
|
129
|
+
end
|
|
130
|
+
end
|
|
141
131
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
132
|
+
def self.ignore_postgis_system_tables
|
|
133
|
+
if ActiveRecord.respond_to?(:schema_ignored_tables)
|
|
134
|
+
ActiveRecord.schema_ignored_tables |= POSTGIS_SYSTEM_TABLES
|
|
135
|
+
else
|
|
136
|
+
PostgreSQL::SchemaDumper.ignore_tables |= POSTGIS_SYSTEM_TABLES
|
|
145
137
|
end
|
|
138
|
+
end
|
|
146
139
|
|
|
147
|
-
|
|
140
|
+
module TypeRegistration
|
|
141
|
+
def self.register!(m)
|
|
142
|
+
m.register_type("geometry") { |_, _, sql| from_sql(sql) }
|
|
143
|
+
m.register_type("geography") { |_, _, sql| from_sql(sql) }
|
|
144
|
+
end
|
|
148
145
|
|
|
149
|
-
def
|
|
150
|
-
# Handle empty sql_type (common in joins) - this is an upstream Rails issue
|
|
151
|
-
# where sql_type comes back as empty string, making it impossible to determine
|
|
152
|
-
# the correct spatial type properties
|
|
146
|
+
def self.from_sql(sql_type)
|
|
153
147
|
if sql_type.nil? || sql_type.empty?
|
|
154
|
-
# Log warning about potential type mismatch due to upstream issue
|
|
155
|
-
# Users experiencing this should use explicit attribute registration as workaround
|
|
156
|
-
# See: https://github.com/rgeo/activerecord-postgis-adapter/pull/334
|
|
157
148
|
return Type::Geometry.new(srid: 0, has_z: false, has_m: false, geographic: false)
|
|
158
149
|
end
|
|
159
150
|
|
|
160
|
-
# Extract SRID and dimensions from SQL type
|
|
161
151
|
srid = extract_srid_from_sql(sql_type)
|
|
162
|
-
# Check for dimension suffixes (e.g., PointZ, PointM, PointZM)
|
|
163
152
|
has_z = sql_type.match?(/\b\w+Z\b|\b\w+ZM\b/)
|
|
164
153
|
has_m = sql_type.match?(/\b\w+M\b|\b\w+ZM\b/)
|
|
165
154
|
geographic = sql_type.start_with?("geography")
|
|
155
|
+
|
|
166
156
|
case sql_type
|
|
167
157
|
when /geography\(Point/i
|
|
168
158
|
Type::Point.new(srid: srid, has_z: has_z, has_m: has_m, geographic: geographic)
|
|
@@ -197,17 +187,22 @@ module ActiveRecord
|
|
|
197
187
|
when /geometry/i
|
|
198
188
|
Type::Geometry.new(srid: srid, has_z: has_z, has_m: has_m)
|
|
199
189
|
else
|
|
200
|
-
# Fallback for unrecognized types
|
|
201
190
|
Type::Geometry.new(srid: srid, has_z: has_z, has_m: has_m)
|
|
202
191
|
end
|
|
203
192
|
end
|
|
204
193
|
|
|
205
|
-
def extract_srid_from_sql(sql_type)
|
|
206
|
-
# Extract SRID from patterns like geometry(Point,3785) or geography(Point,4326)
|
|
194
|
+
def self.extract_srid_from_sql(sql_type)
|
|
207
195
|
match = sql_type.match(/,(\d+)\)/)
|
|
208
196
|
match ? match[1].to_i : 0
|
|
209
197
|
end
|
|
210
198
|
end
|
|
199
|
+
|
|
200
|
+
module RegisterTypes
|
|
201
|
+
def initialize_type_map(m = type_map)
|
|
202
|
+
super
|
|
203
|
+
TypeRegistration.register!(m)
|
|
204
|
+
end
|
|
205
|
+
end
|
|
211
206
|
end
|
|
212
207
|
end
|
|
213
208
|
end
|
data/lib/activerecord-postgis.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: activerecord-postgis
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Abdelkader Boudih
|
|
@@ -18,7 +18,7 @@ dependencies:
|
|
|
18
18
|
version: 8.1.0
|
|
19
19
|
- - "<"
|
|
20
20
|
- !ruby/object:Gem::Version
|
|
21
|
-
version: '8.
|
|
21
|
+
version: '8.3'
|
|
22
22
|
type: :runtime
|
|
23
23
|
prerelease: false
|
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -28,7 +28,7 @@ dependencies:
|
|
|
28
28
|
version: 8.1.0
|
|
29
29
|
- - "<"
|
|
30
30
|
- !ruby/object:Gem::Version
|
|
31
|
-
version: '8.
|
|
31
|
+
version: '8.3'
|
|
32
32
|
- !ruby/object:Gem::Dependency
|
|
33
33
|
name: pg
|
|
34
34
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -43,6 +43,20 @@ dependencies:
|
|
|
43
43
|
- - ">="
|
|
44
44
|
- !ruby/object:Gem::Version
|
|
45
45
|
version: '0'
|
|
46
|
+
- !ruby/object:Gem::Dependency
|
|
47
|
+
name: rgeo
|
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
|
49
|
+
requirements:
|
|
50
|
+
- - ">="
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
version: 3.1.0
|
|
53
|
+
type: :runtime
|
|
54
|
+
prerelease: false
|
|
55
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
56
|
+
requirements:
|
|
57
|
+
- - ">="
|
|
58
|
+
- !ruby/object:Gem::Version
|
|
59
|
+
version: 3.1.0
|
|
46
60
|
- !ruby/object:Gem::Dependency
|
|
47
61
|
name: rgeo-activerecord
|
|
48
62
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -76,6 +90,7 @@ files:
|
|
|
76
90
|
- lib/active_record/connection_adapters/postgis/oid/spatial.rb
|
|
77
91
|
- lib/active_record/connection_adapters/postgis/oid/spatial_types.rb
|
|
78
92
|
- lib/active_record/connection_adapters/postgis/quoting.rb
|
|
93
|
+
- lib/active_record/connection_adapters/postgis/railtie.rb
|
|
79
94
|
- lib/active_record/connection_adapters/postgis/schema_dumper.rb
|
|
80
95
|
- lib/active_record/connection_adapters/postgis/schema_statements.rb
|
|
81
96
|
- lib/active_record/connection_adapters/postgis/spatial_column_methods.rb
|
|
@@ -112,13 +127,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
112
127
|
- - ">="
|
|
113
128
|
- !ruby/object:Gem::Version
|
|
114
129
|
version: 3.3.0
|
|
130
|
+
- - "<"
|
|
131
|
+
- !ruby/object:Gem::Version
|
|
132
|
+
version: '5.0'
|
|
115
133
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
134
|
requirements:
|
|
117
135
|
- - ">="
|
|
118
136
|
- !ruby/object:Gem::Version
|
|
119
137
|
version: '0'
|
|
120
138
|
requirements: []
|
|
121
|
-
rubygems_version:
|
|
139
|
+
rubygems_version: 4.0.10
|
|
122
140
|
specification_version: 4
|
|
123
141
|
summary: PostGIS Type support for ActiveRecord
|
|
124
142
|
test_files: []
|