has_geo_lookup 0.2.1 → 0.2.2

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: c346daadf2a1be6115c2c5a5568f3298a90fa7320b8418ffbb1404c48f1e3be4
4
- data.tar.gz: 39fbae916da78a3aa2646e5ef0770f67fb65d15d37b276e9963f045354974882
3
+ metadata.gz: 6cd5875015bfee6d81f04d358796a47694b5aea8fad959bef3c86cced8db6896
4
+ data.tar.gz: 2dcbbe4f2fed3cc17b7875a29157c0f2688dc40139655b83677043afd8950528
5
5
  SHA512:
6
- metadata.gz: b116a1d609b20c28140e37cf62389b520d4caef383a6abf34e9eacd7b60415929ac3ea9ad464f0ea15abf9fb563d59375dbc47eabdb860b4a19e08944777b2a0
7
- data.tar.gz: df4d371bd9667eb8605a32dafbd23271e00b86bfb16a4e38f2d328a294c8e97789c2cec9a87802d4badf2ebfa85b952003d020df9923b8ee5f4175570108403d
6
+ metadata.gz: b7025ec64ed8e092cd88d3d8e7e4f99e5b64cdbe787f08f7d7c4096ae2e5155065d96d4dcdcb3850d89f68063d8a0c43b9b7957749d77897749fbb26d16e9d80
7
+ data.tar.gz: a9073f68cc449421fb2dc0bf2f4e3b710d68999418fb6d4b2d551fdf61e9ae592058566a359da352413653b0f3ce107870588d531a93e860d9a5e53aaeed1ddb
@@ -54,12 +54,12 @@ class Geoboundary < ActiveRecord::Base
54
54
  }
55
55
 
56
56
  scope :containing_point, ->(latitude, longitude) {
57
- where("ST_Contains(boundary, ST_GeomFromText(?, 4326))", "POINT(#{longitude} #{latitude})")
57
+ where("ST_Contains(boundary, ST_GeomFromText(?, 4326))", "POINT(#{latitude} #{longitude})")
58
58
  }
59
59
 
60
60
  # Check if this boundary contains the given coordinates
61
61
  #
62
- # Uses PostGIS ST_Contains function to perform precise geometric containment
62
+ # Uses MySQL ST_Contains function to perform precise geometric containment
63
63
  # testing against the boundary polygon.
64
64
  #
65
65
  # @param latitude [Float] Latitude in decimal degrees
@@ -72,7 +72,7 @@ class Geoboundary < ActiveRecord::Base
72
72
  def contains_point?(latitude, longitude)
73
73
  return false unless latitude && longitude && boundary
74
74
 
75
- point_wkt = "POINT(#{longitude} #{latitude})"
75
+ point_wkt = "POINT(#{latitude} #{longitude})"
76
76
 
77
77
  self.class.connection.select_value(
78
78
  "SELECT ST_Contains(ST_GeomFromText(?), ST_GeomFromText(?, 4326)) AS contains",
@@ -45,13 +45,13 @@ class Metro < ActiveRecord::Base
45
45
  scope :containing_point, ->(latitude, longitude) {
46
46
  joins(:geoboundaries)
47
47
  .where("ST_Contains(geoboundaries.boundary, ST_GeomFromText(?, 4326))",
48
- "POINT(#{longitude} #{latitude})")
48
+ "POINT(#{latitude} #{longitude})")
49
49
  .distinct
50
50
  }
51
51
 
52
52
  # Check if this metro contains the given coordinates
53
53
  #
54
- # Uses PostGIS spatial queries against all associated geoboundaries to determine
54
+ # Uses MySQL spatial queries against all associated geoboundaries to determine
55
55
  # if the point falls within any boundary that defines this metropolitan area.
56
56
  #
57
57
  # @param latitude [Float] Latitude in decimal degrees
@@ -68,7 +68,7 @@ class Metro < ActiveRecord::Base
68
68
  # Check if point is contained within any of the metro's boundaries
69
69
  geoboundaries.joins("INNER JOIN geoboundaries gb ON gb.id = geoboundaries.id")
70
70
  .where("ST_Contains(gb.boundary, ST_GeomFromText(?, 4326))",
71
- "POINT(#{longitude} #{latitude})")
71
+ "POINT(#{latitude} #{longitude})")
72
72
  .exists?
73
73
  rescue => e
74
74
  Rails.logger.warn "Error checking metro point containment: #{e.message}"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HasGeoLookup
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_geo_lookup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Edlund