-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 coordinate arrays instead of independent latitude and longitude parameters in ActiveRecord #1524
Comments
Thanks for this. You make an interesting point. However, I believe Postgres's |
I see what you did there. Yes, it does seem that point is normally intended for use in cartesian planes, ergo the associated native Postgresql geometric functions would certainly not be helpful for geocoder. I was originally considering this feature request from a consistency and simplicity perspective: two floats named latitude and longitude don't have native Postgresql geometry functions either, and if one were to simply use Then I took a glance at PostGIS, the geospatial extension to PostgreSQL. It appears that the geography datatype does adhere to WGS 84 and casts from POINT, however clearly some experimentation is going to have to be done to confirm that ActiveRecord and PostGIS play well together before pushing for any PostGIS functionality in Geocoder. I'll see what I can do about standing up a test environment to see how AR and PostGIS like each other and get back to you here on the results of those tests. |
Ha! I assure you, that was unintentional. Thanks for doing this research. This all lives near the edge of what I see as Geocoder's domain. The rgeo gem is great for using ActiveRecord with PostGIS. Because rgeo exists (and is good), I've decided to include only rudimentary geo-search features in Geocoder, and to focus instead on fetching data from APIs. But if there's something simple we can do to help support the use of rgeo, I think I'd be open to that. |
I was unfamiliar with rgeo, but will definitely look into that gem. |
This is a feature request.
I have just started experimenting with storing GPS coordinates in PostgreSQL using the
point
geometric type. According to the PostgreSQL manual, it represents a pair of x and y coordinates as a pair of floating-point variables, which seems ideal for this library.However it appears that accessing latitude and longitude through independent parameters is hard coded when interfacing with ActiveRecord, see the following example:
app/models/organization.rb:
Expected behavior
I would have hoped this just worked as a model with independent latitude and longitude parameters would:
Actual behavior
Instead, it fails like this:
Steps to reproduce
t.column :coordinates, :point
geocoded_by :address, coordinates: :coordinates
Environment info
The text was updated successfully, but these errors were encountered: