Module: ArcGISKmzFeatures
- Defined in:
- lib/spatial_features/import/arcgis_kmz_features.rb
Defined Under Namespace
Classes: UpdateError
Instance Method Summary collapse
- #feature_update_error ⇒ Object
- #update_features!(options = {}) ⇒ Object
- #updating_features? ⇒ Boolean
Instance Method Details
#feature_update_error ⇒ Object
37 38 39 |
# File 'lib/spatial_features/import/arcgis_kmz_features.rb', line 37 def feature_update_error (Delayed::Job.where(queue: "#{self.class}/#{self.id}/update_features").where.not(failed_at: nil).first.try(:last_error) || '').split("\n").first end |
#update_features!(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/spatial_features/import/arcgis_kmz_features.rb', line 5 def update_features!( = {}) @skip_invalid = [:skip_invalid] @make_valid = [:make_valid] @feature_error_messages = [] kml_array = [] cache_kml = '' Array(arcgis_kmz_url).each do |url| kml_array << open_kmz_url(url) cache_kml << kml_array.last.to_s end if has_spatial_features_hash? new_features_hash = Digest::MD5.hexdigest(cache_kml) if cache_kml.present? if new_features_hash != self.features_hash replace_features(kml_array) update_attributes(:features_hash => new_features_hash) else return false end else replace_features(kml_array) end return true end |
#updating_features? ⇒ Boolean
33 34 35 |
# File 'lib/spatial_features/import/arcgis_kmz_features.rb', line 33 def updating_features? Delayed::Job.where(queue: "#{self.class}/#{self.id}/update_features", failed_at: nil).exists? end |