spatial_features 1.4.6 → 1.4.7
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/lib/spatial_features/has_spatial_features.rb +6 -10
- data/lib/spatial_features/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d3efc2d6c406b0428852a67e4773ef4991b6ebe7
|
|
4
|
+
data.tar.gz: c8c95001752f7b34467e9fd54637d89b627b2373
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
|
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
|
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.
|
|
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-
|
|
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.
|
|
120
|
+
rubygems_version: 2.4.6
|
|
121
121
|
signing_key:
|
|
122
122
|
specification_version: 4
|
|
123
123
|
summary: Adds spatial methods to a model.
|