spatial_features 2.7.7 → 2.7.8
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 +11 -1
- data/lib/spatial_features/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 43b6f41ecc826e85e2be68987e93993eadf956bd9b97e8cf690ad3f8e5afda6f
|
|
4
|
+
data.tar.gz: 0bb2d37dc10ac0ab0c7e1a69d35f41c1a3bd5770c2a899846064227eb2f5ccc7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
|
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
|
|
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.
|
|
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-
|
|
12
|
+
date: 2019-09-10 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rails
|