spatial_features 2.11.1 → 2.13.0
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88c320989e3fc2fa794540eceda94ca135c83992bdb8d95beae96cb23547253b
|
4
|
+
data.tar.gz: '08acd270a048acc72c637876d36f7d4d39b4270f47f02f8cd51d80a834348c07'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4597a17999f3503d80ae00d40072c9335a9a0141fc277f952328a868b3d339cdcc236929b2bdc914f42eafe1229cde317202eb7064cab956d467257747d44152
|
7
|
+
data.tar.gz: e859fc1b6fb70a1f2ad453d5e8017799f2d7b6c9212fd04f8abaf3c4c7958e7383ebd71b23fd51accb9f5ed168955afcfa49ae20b5d0486b44f0580a907a2586
|
@@ -17,7 +17,8 @@ class AbstractFeature < ActiveRecord::Base
|
|
17
17
|
after_save :cache_derivatives, :if => :saved_change_to_geog?
|
18
18
|
|
19
19
|
def self.cache_key
|
20
|
-
|
20
|
+
result = connection.select_one(all.select('max(id) AS max, count(*) AS count').to_sql)
|
21
|
+
"#{result['max']}-#{result['count']}"
|
21
22
|
end
|
22
23
|
|
23
24
|
def self.with_metadata(k, v)
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module PostGISTypes
|
2
|
-
def initialize_type_map(
|
2
|
+
def initialize_type_map(m = type_map)
|
3
3
|
super
|
4
|
-
register_class_with_limit
|
5
|
-
register_class_with_limit
|
4
|
+
register_class_with_limit m, 'geometry', ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID::SpecializedString
|
5
|
+
register_class_with_limit m, 'geography', ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID::SpecializedString
|
6
6
|
end
|
7
7
|
end
|
8
8
|
|
@@ -36,12 +36,8 @@ module SpatialFeatures
|
|
36
36
|
true
|
37
37
|
end
|
38
38
|
|
39
|
-
# Add methods to generate cache keys for a record or all records of this class
|
40
|
-
# NOTE: features are never updated, only deleted and created, therefore we can
|
41
|
-
# tell if they have changed by finding the maximum id and count instead of needing timestamps
|
42
39
|
def features_cache_key
|
43
|
-
#
|
44
|
-
"#{name}/#{features.cache_key}"
|
40
|
+
"#{name}/#{aggregate_features.cache_key}"
|
45
41
|
end
|
46
42
|
|
47
43
|
def intersecting(other, options = {})
|
@@ -81,6 +77,15 @@ module SpatialFeatures
|
|
81
77
|
end
|
82
78
|
end
|
83
79
|
|
80
|
+
def aggregate_features
|
81
|
+
type = base_class.to_s # Rails stores polymorphic foreign keys as the base class
|
82
|
+
if all == unscoped
|
83
|
+
AggregateFeature.where(:spatial_model_type => type)
|
84
|
+
else
|
85
|
+
AggregateFeature.where(:spatial_model_type => type, :spatial_model_id => all.unscope(:select))
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
84
89
|
# 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
90
|
def has_spatial_features_hash?
|
86
91
|
column_names.include? 'features_hash'
|
@@ -163,7 +168,7 @@ module SpatialFeatures
|
|
163
168
|
end
|
164
169
|
|
165
170
|
def features_cache_key
|
166
|
-
"#{self.class.name}/#{
|
171
|
+
"#{self.class.name}/#{id}-#{has_spatial_features_hash? ? features_hash : aggregate_feature.cache_key}"
|
167
172
|
end
|
168
173
|
|
169
174
|
def polygons?
|
@@ -179,7 +184,11 @@ module SpatialFeatures
|
|
179
184
|
end
|
180
185
|
|
181
186
|
def features?
|
182
|
-
features.
|
187
|
+
if features.loaded?
|
188
|
+
features.present?
|
189
|
+
else
|
190
|
+
features.exists?
|
191
|
+
end
|
183
192
|
end
|
184
193
|
|
185
194
|
def intersects?(other)
|
@@ -67,9 +67,10 @@ module SpatialFeatures
|
|
67
67
|
private
|
68
68
|
|
69
69
|
def spatial_feature_imports(import_options, make_valid)
|
70
|
-
import_options.
|
71
|
-
|
72
|
-
|
70
|
+
import_options.flat_map do |data_method, importer_name|
|
71
|
+
Array.wrap(send(data_method)).map do |data|
|
72
|
+
spatial_importer_from_name(importer_name).new(data, :make_valid => make_valid) if data.present?
|
73
|
+
end
|
73
74
|
end.compact
|
74
75
|
end
|
75
76
|
|
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.13.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-09-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
version: '4.2'
|
21
21
|
- - "<"
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: '
|
23
|
+
version: '6.0'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -30,7 +30,7 @@ dependencies:
|
|
30
30
|
version: '4.2'
|
31
31
|
- - "<"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '6.0'
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: delayed_job_active_record
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
@@ -51,14 +51,14 @@ dependencies:
|
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '3.0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
57
|
version_requirements: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '3.0'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
63
|
name: rubyzip
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
@@ -220,8 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
220
220
|
- !ruby/object:Gem::Version
|
221
221
|
version: '0'
|
222
222
|
requirements: []
|
223
|
-
|
224
|
-
rubygems_version: 2.7.9
|
223
|
+
rubygems_version: 3.0.3
|
225
224
|
signing_key:
|
226
225
|
specification_version: 4
|
227
226
|
summary: Adds spatial methods to a model.
|