I have a list of companies with addresses, and user, that send claims (also set their own location).
And I need to send email only for that companies which are in 20 miles near the user. How can I do that?
I have a list of companies with addresses, and user, that send claims (also set their own location).
And I need to send email only for that companies which are in 20 miles near the user. How can I do that?
Not sure why you want to use Google Maps, since you are sending emails and not displaying locations on the map, right?
I think your best answer is to convert the addresses into latitude and longitude using a geocode service, and then throw them into Mongo or other DB that supports geospatial indexing.
So in Mongo DB after geocoding, you need to convert each address into something like:
{email: 'foobar@foobar.com', address: 'address', loc : { lon : 40.739037, lat: 73.992964 } }
After that you can query the DB to pull out emails for the user, in Mongo it would be something like:
db.emails.find( { loc : { $near : [50,50] } } ).limit(20)