spatial_features 2.2.2 → 2.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/feature.rb +6 -5
- data/lib/spatial_features/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 417844aeba55e727bdb873b0492a6de02c9597af
|
4
|
+
data.tar.gz: '096586ef1f32f9091c55c9e2142c2736cd3db0ad'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fbaab3c02159dea567e0456fc5996f0d5979f26607d7c8e20ff264d27758af6417ae36837b60514ea71531babddb6d0d681772f4c9ffda9fd2589c188ceea2b
|
7
|
+
data.tar.gz: 0d823427501023ceec92a8f6f6e581653d299dfa9534f7d96cd79606476f22be61c484b82c16656b6f8f0129433a7da183aed4993d2e42a9fa038d7cc2ec8566
|
data/app/models/feature.rb
CHANGED
@@ -37,11 +37,12 @@ class Feature < ActiveRecord::Base
|
|
37
37
|
unscoped { connection.select_value(select('ST_Area(ST_Union(geom))').from(current_scope, :features)).to_f }
|
38
38
|
end
|
39
39
|
|
40
|
-
def self.total_intersection_area_in_square_meters(other_features)
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
40
|
+
def self.total_intersection_area_in_square_meters(other_features, geom = 'geom_lowres')
|
41
|
+
scope = unscope(:select).select("ST_Union(#{geom}) AS geom")
|
42
|
+
other_scope = other_features.unscope(:select).select("ST_Union(#{geom}) AS geom")
|
43
|
+
query = unscoped.select('ST_Area(ST_Intersection(features.geom, other_features.geom))').from("(#{scope.to_sql}) features, (#{other_scope.to_sql}) other_features")
|
44
|
+
|
45
|
+
return connection.select_value(query).to_f
|
45
46
|
end
|
46
47
|
|
47
48
|
def self.intersecting(other)
|