spatial_features 2.7.7 → 2.7.8

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: a1569586b460b18ee4a83871a3af3c5b4d8b54a5fbe84d9a4f1b3a191658a31f
4
- data.tar.gz: d69c1f4fa29bd3b6b15770a59af3821521942723091def5945b6c065454ace5b
3
+ metadata.gz: 43b6f41ecc826e85e2be68987e93993eadf956bd9b97e8cf690ad3f8e5afda6f
4
+ data.tar.gz: 0bb2d37dc10ac0ab0c7e1a69d35f41c1a3bd5770c2a899846064227eb2f5ccc7
5
5
  SHA512:
6
- metadata.gz: df9042d3ef062b8662697970fe58715b27d69bdc46acead5d030697b4461ee25b06ad9afd0b6b03ebbba57b4f93e89cebe7278da5a9897b1e42f7c9135dbeb59
7
- data.tar.gz: b64e7d40f30753e25be1d5be07b7b7261b72def8ca3eaffa622541386a772c5d39bdda7b94c70922ea9bebbb833bc292ea15dd4b5bf08c8796457f22fea4d5f8
6
+ metadata.gz: 3eb2027c5e4f5ab75f592834d9fcfa496c9211c5ae626e1d29fadb3ebd9cbccd7516de96a978da7601f5aa0bbb277a32b8eac50796f5321c2bf81d7018664aea
7
+ data.tar.gz: 00ea8df16128ca618626c4d2b2db34c7551863cc1951f1fcea9282e821cc98ff53a1234df4efd65384364e7b58c6d69e0101a03ccdfdc1a07a7e5945ef26aee8
@@ -136,7 +136,17 @@ module SpatialFeatures
136
136
  end
137
137
 
138
138
  scope = scope.select("MIN(ST_Distance(features.geom, other_features.geom)) AS distance_in_meters") if options[:distance]
139
- scope = scope.select("ST_Area(ST_UNION(ST_Intersection(ST_CollectionExtract(features.geom, 3), ST_CollectionExtract(other_features.geom, 3)))) AS intersection_area_in_square_meters") if options[:intersection_area]
139
+ scope = scope.select <<~SQL if options[:intersection_area]
140
+ ST_Area(
141
+ ST_Intersection(
142
+ /* Extract only polygons to calculations since we're calculating area */
143
+ /* Union to aggregate features from all records in the query before intersection to flatten geometry and avoid possible self intersection */
144
+ ST_Union(ST_CollectionExtract(features.geom, 3)),
145
+ ST_Union(ST_CollectionExtract(other_features.geom, 3))
146
+ )
147
+ ) AS intersection_area_in_square_meters
148
+ SQL
149
+
140
150
  return scope
141
151
  end
142
152
 
@@ -1,3 +1,3 @@
1
1
  module SpatialFeatures
2
- VERSION = "2.7.7"
2
+ VERSION = "2.7.8"
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.7.7
4
+ version: 2.7.8
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: 2019-07-27 00:00:00.000000000 Z
12
+ date: 2019-09-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails