spatial_features 2.8.0 → 2.8.1
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 +12 -0
- data/app/models/aggregate_feature.rb +0 -2
- data/app/models/feature.rb +2 -2
- data/lib/spatial_features/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a552c3fb981fc7975a5705aa28d86289ed464b7a64722467cd3ddf72efd108bb
|
4
|
+
data.tar.gz: 5186ba8c1aef2caf35332d97cc2548ed45399104fea049dd54843497aad14340
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 130ae9b556794fc4622654222927f63875d1ba1e4943a6e17fc714ca7c2ff4d72fc90bd214de1e70826adb9167e7ca7141cef97180048dd7b0d70a7ee2e76fb8
|
7
|
+
data.tar.gz: a0a4207e6890cbc5daa7606bb02bd9014d0afe2a382bdb729a79f85b8263c3f204cfca87bc08579f7f1a870517041c4eda6c4d70daf634dafb0d6dd7664f1815
|
data/README.md
CHANGED
@@ -138,3 +138,15 @@ Default options can be specified on the Shapefile importer class itself.
|
|
138
138
|
```
|
139
139
|
|
140
140
|
Default: `nil`
|
141
|
+
|
142
|
+
## Upgrading From 2.7.x to 2.8.0
|
143
|
+
Features now generate an `AggregateFeature` comprised of a union of all their spatial model's features. This improves query performance because
|
144
|
+
unioning is precalculated in these shapes instead of at query time.
|
145
|
+
|
146
|
+
```ruby
|
147
|
+
# In your migration
|
148
|
+
add_column :features, :type, :string
|
149
|
+
Feature.reset_column_information
|
150
|
+
AbstractFeature.update_all(:type => 'Feature')
|
151
|
+
Feature.refresh_aggregates
|
152
|
+
```
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require_dependency SpatialFeatures::Engine.root.join('app/models/abstract_feature')
|
2
|
-
|
3
1
|
class AggregateFeature < AbstractFeature
|
4
2
|
has_many :features, lambda { |aggregate| where(:spatial_model_type => aggregate.spatial_model_type) }, :foreign_key => :spatial_model_id, :primary_key => :spatial_model_id
|
5
3
|
|
data/app/models/feature.rb
CHANGED
@@ -34,11 +34,11 @@ class Feature < AbstractFeature
|
|
34
34
|
.where.not(:spatial_model_type => nil, :spatial_model_id => nil)
|
35
35
|
.group('spatial_model_type, spatial_model_id')
|
36
36
|
|
37
|
-
|
37
|
+
# Unscope so that newly built AggregateFeatures get their type column set correctly
|
38
|
+
AbstractFeature.unscoped { where(:id => ids).find_each(&:refresh_aggregate) }
|
38
39
|
end
|
39
40
|
|
40
41
|
def refresh_aggregate
|
41
|
-
# puts "Refreshing AggregateFeature for #{spatial_model_type} #{spatial_model_id}"
|
42
42
|
build_aggregate_feature unless aggregate_feature&.persisted?
|
43
43
|
aggregate_feature.refresh
|
44
44
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spatial_features
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.8.
|
4
|
+
version: 2.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Wallace
|
@@ -220,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
220
220
|
version: '0'
|
221
221
|
requirements: []
|
222
222
|
rubyforge_project:
|
223
|
-
rubygems_version: 2.7.
|
223
|
+
rubygems_version: 2.7.5
|
224
224
|
signing_key:
|
225
225
|
specification_version: 4
|
226
226
|
summary: Adds spatial methods to a model.
|