spatial_features 1.4.6 → 1.4.7

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
  SHA1:
3
- metadata.gz: e27151385100d922d8a64f10fedcc3e807e28482
4
- data.tar.gz: 44261407916d79df9256a84609e6c033ae3eace0
3
+ metadata.gz: d3efc2d6c406b0428852a67e4773ef4991b6ebe7
4
+ data.tar.gz: c8c95001752f7b34467e9fd54637d89b627b2373
5
5
  SHA512:
6
- metadata.gz: c4c810a96a8bbc0a54ea54321ac3f2ef29f5d0453729054c102a4e32daa99b180b70679409ed883cc3142eb1321c03f5efe2ec45a5bcad90ed4b817f3433584d
7
- data.tar.gz: 580a73af6c334c7ab9c1e7560e0b7997efd35100c61fd6751455d92a1d4236e9e1375adbe5bedcfe182d9ef5f0fc608b2628ed6810c519ad1620b4d6bfcfa784
6
+ metadata.gz: 0dda0b1e79fffd25931b7b3cc0ae9a32de9524debadfd26b3cd8bdcd2252ecb8655e6de5c3f4d458c589cad7589e7a062a1b556df112e6017013739a15504270
7
+ data.tar.gz: 992838a271527d54765386d31ec536d1baa1355812808260cd69190d637258b68a5c2000de99aec931925b55a635ce76c976f7a356cc5542cb6f58b3dc794305
@@ -187,20 +187,12 @@ module SpatialFeatures
187
187
  self.class.intersecting(other).exists?(self)
188
188
  end
189
189
 
190
- def total_intersection_area_in_hectares(klass)
191
- Formatters::HECTARES.call(total_intersection_area_in_square_meters(klass))
192
- end
193
-
194
190
  def total_intersection_area_percentage(klass)
195
191
  return 0.0 unless features_area_in_square_meters > 0
196
192
 
197
193
  ((total_intersection_area_in_square_meters(klass) / features_area_in_square_meters) * 100).round(1)
198
194
  end
199
195
 
200
- def features_area_in_hectares
201
- Formatters::HECTARES.call(features_area_in_square_meters)
202
- end
203
-
204
196
  def features_area_in_square_meters
205
197
  @features_area_in_square_meters ||= features.area
206
198
  end
@@ -217,13 +209,17 @@ module SpatialFeatures
217
209
  end
218
210
 
219
211
  def update_features_area
220
- update_column :features_area, features.area
212
+ update_column :features_area, features.area(:cache => false)
221
213
  end
222
214
  end
223
215
 
224
216
  module FeaturesAssociationExtensions
225
217
  def area(options = {})
226
- options[:cache] == false ? connection.select_value(all.select('ST_Area(ST_UNION(geom))')).to_f : proxy_association.owner.features_area
218
+ if options[:cache] == false
219
+ connection.select_value(all.select('ST_Area(ST_UNION(geom))')).try(:to_f)
220
+ else
221
+ proxy_association.owner.features_area
222
+ end
227
223
  end
228
224
  end
229
225
  end
@@ -1,3 +1,3 @@
1
1
  module SpatialFeatures
2
- VERSION = "1.4.6"
2
+ VERSION = "1.4.7"
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: 1.4.6
4
+ version: 1.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Wallace
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-01-19 00:00:00.000000000 Z
12
+ date: 2016-01-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -117,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
117
  version: '0'
118
118
  requirements: []
119
119
  rubyforge_project:
120
- rubygems_version: 2.4.5.1
120
+ rubygems_version: 2.4.6
121
121
  signing_key:
122
122
  specification_version: 4
123
123
  summary: Adds spatial methods to a model.