spatial_features 1.5.10 → 1.5.11

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
  SHA1:
3
- metadata.gz: 0307a9516187c3bbfed164e679d85d8aafd88d52
4
- data.tar.gz: 877f85316e78c8fb6f8737069287bde6c83d0c94
3
+ metadata.gz: b1f2c3d038baab7cfb9b0e8da43f9df18516425a
4
+ data.tar.gz: 6f659cee10eb6583fc25d91aa412b0e9fbd94785
5
5
  SHA512:
6
- metadata.gz: 2e1fdb2c6f5bd8a813fd21587bc526fc40bd620c2331fc1ad80ee0d3e75688b26bbdd64c1404223899efee68834b76a577400b5f86120ede72aa38603024c906
7
- data.tar.gz: bb5616750ff468513c2acf1334217892c48d19624f6b2d6015467526d2910d69a0706aab491eac28901e9ba2c8d036f48d47b874bc21c98375fc561faa2f0c63
6
+ metadata.gz: 0001489c898f5f27c508c9c46bda80a685914ad34f3d63c7da9e2c98e12fe40dc00eac46b2eab9e942cd48587bc5eff696298cea1f74efc7a6dfad81010d1377
7
+ data.tar.gz: 78d28037a3c5e3f1edffc8589b72afb0dd356e7e9cc96a0cd38289a8141cb48045eaf1449d5957c336dbc8f14f6bb935593fd36f8c4fcea11162840fd47f8179
@@ -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, 26910),
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(ST_Transform (geom, 4326)),
70
- east = ST_XMax(ST_Transform (geom, 4326)),
71
- south = ST_YMin(ST_Transform (geom, 4326)),
72
- west = ST_XMin(ST_Transform (geom, 4326))"
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.all
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
- features.total_intersection_area_in_square_meters(other.features)
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)
@@ -1,3 +1,3 @@
1
1
  module SpatialFeatures
2
- VERSION = "1.5.10"
2
+ VERSION = "1.5.11"
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: 1.5.10
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-08 00:00:00.000000000 Z
12
+ date: 2016-07-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails