spatial_features 1.5.10 → 1.5.11
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 +4 -4
- data/app/models/feature.rb +9 -5
- data/lib/spatial_features/has_spatial_features.rb +4 -3
- data/lib/spatial_features/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1f2c3d038baab7cfb9b0e8da43f9df18516425a
|
4
|
+
data.tar.gz: 6f659cee10eb6583fc25d91aa412b0e9fbd94785
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0001489c898f5f27c508c9c46bda80a685914ad34f3d63c7da9e2c98e12fe40dc00eac46b2eab9e942cd48587bc5eff696298cea1f74efc7a6dfad81010d1377
|
7
|
+
data.tar.gz: 78d28037a3c5e3f1edffc8589b72afb0dd356e7e9cc96a0cd38289a8141cb48045eaf1449d5957c336dbc8f14f6bb935593fd36f8c4fcea11162840fd47f8179
|
data/app/models/feature.rb
CHANGED
@@ -61,15 +61,15 @@ class Feature < ActiveRecord::Base
|
|
61
61
|
options.reverse_merge! :lowres_simplification => 0.00001, :lowres_precision => 5
|
62
62
|
|
63
63
|
update_all("area = ST_Area(geog),
|
64
|
-
geom = ST_Transform(geog::geometry,
|
64
|
+
geom = ST_Transform(geog::geometry, #{detect_srid('geom')}),
|
65
65
|
geog_lowres = ST_SimplifyPreserveTopology(geog::geometry, #{options[:lowres_simplification]})"
|
66
66
|
.squish)
|
67
67
|
update_all("kml = ST_AsKML(features.geog, 6),
|
68
68
|
kml_lowres = ST_AsKML(geog_lowres::geometry, #{options[:lowres_precision]}),
|
69
|
-
north = ST_YMax(
|
70
|
-
east = ST_XMax(
|
71
|
-
south = ST_YMin(
|
72
|
-
west = ST_XMin(
|
69
|
+
north = ST_YMax(geog::geometry),
|
70
|
+
east = ST_XMax(geog::geometry),
|
71
|
+
south = ST_YMin(geog::geometry),
|
72
|
+
west = ST_XMin(geog::geometry)"
|
73
73
|
.squish)
|
74
74
|
end
|
75
75
|
|
@@ -87,6 +87,10 @@ class Feature < ActiveRecord::Base
|
|
87
87
|
|
88
88
|
private
|
89
89
|
|
90
|
+
def self.detect_srid(column_name)
|
91
|
+
connection.select_value("SELECT Find_SRID('public', '#{table_name}', '#{column_name}')")
|
92
|
+
end
|
93
|
+
|
90
94
|
def self.join_other_features(other)
|
91
95
|
joins('INNER JOIN features AS other_features ON true').where(:other_features => {:id => other})
|
92
96
|
end
|
@@ -66,10 +66,10 @@ module SpatialFeatures
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def features
|
69
|
-
if all == unscoped
|
69
|
+
if all == unscoped
|
70
70
|
Feature.where(:spatial_model_type => self)
|
71
71
|
else
|
72
|
-
Feature.where(:spatial_model_type => self, :spatial_model_id => all)
|
72
|
+
Feature.where(:spatial_model_type => self, :spatial_model_id => all.unscope(:select))
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
@@ -206,7 +206,8 @@ module SpatialFeatures
|
|
206
206
|
end
|
207
207
|
|
208
208
|
def total_intersection_area_in_square_meters(other)
|
209
|
-
|
209
|
+
other = other.intersecting(self) unless other.is_a?(ActiveRecord::Base)
|
210
|
+
return features.total_intersection_area_in_square_meters(other.features)
|
210
211
|
end
|
211
212
|
|
212
213
|
def spatial_cache_for?(klass, buffer_in_meters)
|
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: 1.5.
|
4
|
+
version: 1.5.11
|
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: 2016-07-
|
12
|
+
date: 2016-07-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|