spatial_features 2.19.0 → 2.19.1

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: a0d49ba8050fb39cb929127a633f92bddc901d7851e5e02ac7459db8edbfe790
4
- data.tar.gz: 3f0c2d8ed22051efe5e11f0735c5430d8f9a0d11c94550b2719be338531e0f1e
3
+ metadata.gz: 36eed2c1325bed9be0605ee197dfe74770fd86e2a0e0c032e73937db73519ebc
4
+ data.tar.gz: dc7959b2ed3f6ca983c0dc22c50842bdbf78b73ab47ec8279a8101f0f850f99b
5
5
  SHA512:
6
- metadata.gz: c6d53a0c2c448b51f9344e39be1e271f8a084ccee0e1d3aeefd0252c3d9dfb2b7afcb8ab0b6822e1485a44aecdf79f62615f59f6f169073c74fc61ce70107d32
7
- data.tar.gz: 7dc96d943a8a8695d05ad246c4ffaaa166ff4be40fe10745a671ac4ae89b72ecbae810241fd1dde605d72c57989695d7cbb07a55575799dd8b65eb32d8819d61
6
+ metadata.gz: cf5986e2b8473f571c7faef6044a34b14171779ad46724b3d38916570ca47dff17e57e0ea5ee6d8ae599032ae197ef7177b7113d77911495dc87413570ba630a
7
+ data.tar.gz: 95dbc3d2c8c8dc2535930304823f91746ef293091b70ff9c530fcebdeff65ca8dabca66db78ce6bf68919f4cb5d1afb0b3db8e3ee414130e600b956a285a6a1e
@@ -4,7 +4,11 @@ class AggregateFeature < AbstractFeature
4
4
  has_many :features, lambda { |aggregate| where(:spatial_model_type => aggregate.spatial_model_type) }, :foreign_key => :spatial_model_id, :primary_key => :spatial_model_id
5
5
 
6
6
  # Aggregate the features for the spatial model into a single feature
7
- def refresh
7
+ before_validation :set_geog, :on => :create, :unless => :geog?
8
+
9
+ private
10
+
11
+ def set_geog
8
12
  feature_array_sql = <<~SQL
9
13
  ARRAY[
10
14
  (#{features.select('ST_UNION(ST_CollectionExtract(geog::geometry, 1))').to_sql}),
@@ -19,6 +23,5 @@ class AggregateFeature < AbstractFeature
19
23
  FROM (SELECT unnest(#{feature_array_sql})) AS features
20
24
  WHERE NOT ST_IsEmpty(unnest)
21
25
  SQL
22
- self.save!
23
26
  end
24
27
  end
@@ -1,3 +1,5 @@
1
+ require_dependency SpatialFeatures::Engine.root.join('app/models/abstract_feature')
2
+
1
3
  class Feature < AbstractFeature
2
4
  class_attribute :automatically_refresh_aggregate
3
5
  self.automatically_refresh_aggregate = true
@@ -52,8 +54,8 @@ class Feature < AbstractFeature
52
54
  end
53
55
 
54
56
  def refresh_aggregate
55
- build_aggregate_feature unless aggregate_feature&.persisted?
56
- aggregate_feature.refresh
57
+ aggregate_feature&.destroy # Destroy the existing aggregate feature to ensure its cache key changes when it is refreshed
58
+ create_aggregate_feature!
57
59
  end
58
60
 
59
61
  def automatically_refresh_aggregate?
@@ -77,7 +77,7 @@ module SpatialFeatures
77
77
  update_cached_status(:success)
78
78
  end
79
79
 
80
- def error(job)
80
+ def error(job, exception)
81
81
  update_cached_status(:failure)
82
82
  end
83
83
 
@@ -2,6 +2,9 @@ require 'fileutils'
2
2
 
3
3
  module SpatialFeatures
4
4
  module Unzip
5
+ # paths containing '__macosx' or beginning with a '.'
6
+ IGNORED_ENTRY_PATHS = /(\A|\/)(__macosx|\.)/i.freeze
7
+
5
8
  def self.paths(file_path, find: nil, **extract_options)
6
9
  paths = extract(file_path, **extract_options)
7
10
 
@@ -16,6 +19,7 @@ module SpatialFeatures
16
19
  def self.extract(file_path, output_dir = Dir.mktmpdir, downcase: false)
17
20
  [].tap do |paths|
18
21
  entries(file_path).each do |entry|
22
+ next if entry.name =~ IGNORED_ENTRY_PATHS
19
23
  output_filename = entry.name
20
24
  output_filename = output_filename.downcase if downcase
21
25
  path = "#{output_dir}/#{output_filename}"
@@ -1,3 +1,3 @@
1
1
  module SpatialFeatures
2
- VERSION = "2.19.0"
2
+ VERSION = "2.19.1"
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.19.0
4
+ version: 2.19.1
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: 2021-11-25 00:00:00.000000000 Z
12
+ date: 2021-12-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -175,7 +175,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  - !ruby/object:Gem::Version
176
176
  version: '0'
177
177
  requirements: []
178
- rubygems_version: 3.0.3.1
178
+ rubyforge_project:
179
+ rubygems_version: 2.7.6.3
179
180
  signing_key:
180
181
  specification_version: 4
181
182
  summary: Adds spatial methods to a model.