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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 719c3ecae256a4ccc467f6ae09f2db52f7a087b4
4
- data.tar.gz: 06d8012355564e46386fbfe327e915f3b9fa832d
3
+ metadata.gz: 417844aeba55e727bdb873b0492a6de02c9597af
4
+ data.tar.gz: '096586ef1f32f9091c55c9e2142c2736cd3db0ad'
5
5
  SHA512:
6
- metadata.gz: e6e2990a278cf521a7857e6d1614c2d5be861c534e1f18dfeb1f2f81999808a54f51b2bc348745ffed684857dd62dbc36913ef9b92d7ba10c1cd4c78579cefc5
7
- data.tar.gz: a236dcca05df37c76befe0be99b318aea0118e120822e0783d6415444ebdde7ca08c1315a1a9258c5eff3b1d05e51c182bad04d4599750ac374bf45e5fd91f9a
6
+ metadata.gz: 4fbaab3c02159dea567e0456fc5996f0d5979f26607d7c8e20ff264d27758af6417ae36837b60514ea71531babddb6d0d681772f4c9ffda9fd2589c188ceea2b
7
+ data.tar.gz: 0d823427501023ceec92a8f6f6e581653d299dfa9534f7d96cd79606476f22be61c484b82c16656b6f8f0129433a7da183aed4993d2e42a9fa038d7cc2ec8566
@@ -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
- unscoped
42
- .from("(#{select("ST_Union(geom) AS geom").to_sql}) features, (#{other_features.to_sql}) other_features")
43
- .pluck('ST_Area(ST_UNION(ST_Intersection(features.geom, other_features.geom)))')
44
- .first.to_f
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)
@@ -1,3 +1,3 @@
1
1
  module SpatialFeatures
2
- VERSION = "2.2.2"
2
+ VERSION = "2.2.3"
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.2.2
4
+ version: 2.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Wallace