spatial_features 2.11.0 → 2.11.1

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: fb5268adbbf2c9b9019512e4d3617fc97c587497913202bf95c3dd35332497e8
4
- data.tar.gz: 37928531494a21c1934425bb222759accdbfae763c7eb2e7f5570e8e17c69e42
3
+ metadata.gz: 6c14269424ac2b30935b7f291f51080271e0932c400036bf5156223325ead8ba
4
+ data.tar.gz: d715d47e9dfa87eee07e01bc71b03dc9af5ceb6415552f24663eef9a8d81bda6
5
5
  SHA512:
6
- metadata.gz: d995ebde69133a39e99885ce694551d5bd64fb08a67b8e658d86138f56673b78a27f101f65cb86027e864d3fa0a3e2c05f43d944a3c55b2fac1a3e53a304715b
7
- data.tar.gz: 99be0f11815754302e8b3f1cf50fa31964993fa43d2a1cc5a68e688eacb03d0d2116cea1ff71c7c7c8c2c99a7c7ae76c2dc83c0f6bef34ec525434bb990be2e1
6
+ metadata.gz: 2b7fef2ae89493b544b46896136bddcd59afc470db34be530c2763cede9dca82082c695056583aa7665f03dab0c21f87d16429cc37d74682cf9ac984956c83cb
7
+ data.tar.gz: 16bc0f99d7249a85f0c48e07f0b9dd5b02058fa307c4eea20142dedf6e695b9c035528d26b26c22dc9ec420247d36a4f8476f8e5b5a0fe865bac68650d64ecfb
@@ -148,10 +148,6 @@ class AbstractFeature < ActiveRecord::Base
148
148
  @make_valid
149
149
  end
150
150
 
151
- def wkt
152
- ActiveRecord::Base.connection.select_value("SELECT ST_ASEWKT('#{geom}')")
153
- end
154
-
155
151
  private
156
152
 
157
153
  def make_valid
@@ -81,15 +81,6 @@ 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
-
93
84
  # 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
94
85
  def has_spatial_features_hash?
95
86
  column_names.include? 'features_hash'
@@ -6,22 +6,24 @@ module SpatialFeatures
6
6
  private
7
7
 
8
8
  def each_record(&block)
9
- Nokogiri::XML(@data).css('Placemark').each do |placemark|
10
- name = placemark.css('name').text
11
- metadata = extract_metadata(placemark)
12
-
13
- {'Polygon' => 'POLYGON', 'LineString' => 'LINE', 'Point' => 'POINT'}.each do |kml_type, sql_type|
14
- placemark.css(kml_type).each do |placemark|
15
- next if blank_placemark?(placemark)
16
-
17
- yield OpenStruct.new(:feature_type => sql_type, :geog => geom_from_kml(placemark), :name => name, :metadata => metadata)
9
+ {'Polygon' => 'POLYGON', 'LineString' => 'LINE', 'Point' => 'POINT'}.each do |kml_type, sql_type|
10
+ Nokogiri::XML(@data).css(kml_type).each do |feature|
11
+ if placemark = feature.ancestors('Placemark').first
12
+ name = placemark.css('name').text
13
+ metadata = extract_metadata(placemark)
14
+ else
15
+ metadata = {}
18
16
  end
17
+
18
+ next if blank_feature?(feature)
19
+
20
+ yield OpenStruct.new(:feature_type => sql_type, :geog => geom_from_kml(feature), :name => name, :metadata => metadata)
19
21
  end
20
22
  end
21
23
  end
22
24
 
23
- def blank_placemark?(placemark)
24
- placemark.css('coordinates').text.blank?
25
+ def blank_feature?(feature)
26
+ feature.css('coordinates').text.blank?
25
27
  end
26
28
 
27
29
  def geom_from_kml(kml)
@@ -1,3 +1,3 @@
1
1
  module SpatialFeatures
2
- VERSION = "2.11.0"
2
+ VERSION = "2.11.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.11.0
4
+ version: 2.11.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: 2020-06-01 00:00:00.000000000 Z
12
+ date: 2020-06-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails