spatial_features 2.10.9 → 2.11.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb5268adbbf2c9b9019512e4d3617fc97c587497913202bf95c3dd35332497e8
|
4
|
+
data.tar.gz: 37928531494a21c1934425bb222759accdbfae763c7eb2e7f5570e8e17c69e42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d995ebde69133a39e99885ce694551d5bd64fb08a67b8e658d86138f56673b78a27f101f65cb86027e864d3fa0a3e2c05f43d944a3c55b2fac1a3e53a304715b
|
7
|
+
data.tar.gz: 99be0f11815754302e8b3f1cf50fa31964993fa43d2a1cc5a68e688eacb03d0d2116cea1ff71c7c7c8c2c99a7c7ae76c2dc83c0f6bef34ec525434bb990be2e1
|
@@ -40,6 +40,11 @@ class AbstractFeature < ActiveRecord::Base
|
|
40
40
|
where(:feature_type => 'point')
|
41
41
|
end
|
42
42
|
|
43
|
+
def self.within_distance(lat, lng, distance_in_meters)
|
44
|
+
# where("ST_DWithin(features.geog, ST_SetSRID( ST_Point( -71.104, 42.315), 4326)::geography, :distance)", :lat => lat, :lng => lng, :distance => distance_in_meters)
|
45
|
+
where("ST_DWithin(features.geog, ST_Point(:lng, :lat), :distance)", :lat => lat, :lng => lng, :distance => distance_in_meters)
|
46
|
+
end
|
47
|
+
|
43
48
|
def self.area_in_square_meters(geom = 'geom_lowres')
|
44
49
|
current_scope = all.polygons
|
45
50
|
unscoped { connection.select_value(select("ST_Area(ST_Union(#{geom}))").from(current_scope, :features)).to_f }
|
@@ -81,6 +81,15 @@ module SpatialFeatures
|
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
|
+
def aggregate_features
|
85
|
+
type = base_class.to_s # Rails stores polymorphic foreign keys as the base class
|
86
|
+
if all == unscoped
|
87
|
+
AggregateFeature.where(:spatial_model_type => type)
|
88
|
+
else
|
89
|
+
AggregateFeature.where(:spatial_model_type => type, :spatial_model_id => all.unscope(:select))
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
84
93
|
# Returns true if the model stores a hash of the features so we don't need to process the features if they haven't changed
|
85
94
|
def has_spatial_features_hash?
|
86
95
|
column_names.include? 'features_hash'
|
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.
|
4
|
+
version: 2.11.0
|
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: 2020-
|
12
|
+
date: 2020-06-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|