spatial_features 2.8.0 → 2.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b3acf24e6695a55827725efd2ca6290b96a4ba54d230e8aa176a7bbd356fe6fe
4
- data.tar.gz: 48e9527307f5daabd632acf5e76f9d544bcfc3beaeadacb349c37184986321fa
3
+ metadata.gz: a552c3fb981fc7975a5705aa28d86289ed464b7a64722467cd3ddf72efd108bb
4
+ data.tar.gz: 5186ba8c1aef2caf35332d97cc2548ed45399104fea049dd54843497aad14340
5
5
  SHA512:
6
- metadata.gz: 668a6afb0582a4470d1cab7b2e582392ae8fe392514cc0ac363488458052dd6f90dff13c5004aa5423b25f843bc7b79eec0e1e3e056802d80963b40bd4c6f7e9
7
- data.tar.gz: 7c17ddc09d78bd90ef1d75a5f0cb67ee0ebb47fe286c6a272f3812f5b733e2e29dfce265e2ea8b91512d6dabcb1d2ccad089acf5b3e15c0a7368c41eda2a11e3
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
 
@@ -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
- where(:id => ids).find_each(&:refresh_aggregate)
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
@@ -1,3 +1,3 @@
1
1
  module SpatialFeatures
2
- VERSION = "2.8.0"
2
+ VERSION = "2.8.1"
3
3
  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.0
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.9
223
+ rubygems_version: 2.7.5
224
224
  signing_key:
225
225
  specification_version: 4
226
226
  summary: Adds spatial methods to a model.