Reputation:
I am creating a rails application which will use geolocation. One can add a longi- and latitude to a record. If there are multiple records with geolocations, one can see a Google Map with nearby records, just like Twitter geolocation.
How can I store the coordinates (I don't mind to do calculations) and find nearby records? My database is MySQL.
Thanks.
Upvotes: 1
Views: 3409
Reputation: 490
You can use acts_as_solr_reloaded to index and query your spatial data for this you need not to store latitude and longitude information in your main table but rather it creates a migration which creates a locals table where it stores the latitude and longitude information.And you can query the solr indexes using this also with latitude,longitude and radius.
Upvotes: 1
Reputation: 7500
Geokit is OK for data after it is pulled from a database, but not if you are looking to structure a query from the database using spatial data. If you were only using mysql then you would be kind of stuck doing alot of calculations. Since you are using rails, you have at least this option: http://freelancing-god.github.com/ts/en/geosearching.html which should take care of a great deal of the calculations for you.
Upvotes: 1
Reputation: 7477
There are two approaches you could take, depending on your requirements:
Upvotes: 2