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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c14269424ac2b30935b7f291f51080271e0932c400036bf5156223325ead8ba
|
4
|
+
data.tar.gz: d715d47e9dfa87eee07e01bc71b03dc9af5ceb6415552f24663eef9a8d81bda6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b7fef2ae89493b544b46896136bddcd59afc470db34be530c2763cede9dca82082c695056583aa7665f03dab0c21f87d16429cc37d74682cf9ac984956c83cb
|
7
|
+
data.tar.gz: 16bc0f99d7249a85f0c48e07f0b9dd5b02058fa307c4eea20142dedf6e695b9c035528d26b26c22dc9ec420247d36a4f8476f8e5b5a0fe865bac68650d64ecfb
|
@@ -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
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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
|
24
|
-
|
25
|
+
def blank_feature?(feature)
|
26
|
+
feature.css('coordinates').text.blank?
|
25
27
|
end
|
26
28
|
|
27
29
|
def geom_from_kml(kml)
|
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.
|
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-
|
12
|
+
date: 2020-06-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|