Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for PostGIS in model geocoding #1669

Open
kalsan opened this issue Nov 14, 2024 · 0 comments
Open

Support for PostGIS in model geocoding #1669

kalsan opened this issue Nov 14, 2024 · 0 comments

Comments

@kalsan
Copy link

kalsan commented Nov 14, 2024

Hi Alex!

I've read the discussion over in #1524 and while I fully agree that more complex geocalculations should be left to a dedicated gem, it would still be interesting to see PostGis support in geocoded_by.

Here's my current workaround:

class Foo < ApplicationRecord
  # has columns :address (string), :latitude (decimal), :longitude (decimal) and :coordinates (st_point)

  geocoded_by :address
  after_validation :geocode_postgis
  
  private

  def geocode_postgis
    geocode # fills latitude and longitude
    self.coordinates = "POINT(#{longitude} #{latitude})" # fills postgis
  end
end

While this is not too hard to accomplish, it would be even better to be able to have PostGIS support in geocoder, similar to support (geocoded_by: :coordinates)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant