0

I use angular client and express/mongodb server for my website. I need to implement a location picker.

Here is a demo.

http://plnkr.co/edit/a3KlK8dKH3wwiiksDSn2?p=preview

I need to store users address in my database. I dont want to store the entire complex object as it would be very tedious. (see the screenshot)

I need to be able to suggest friends nearby, same street, or same city, same state etc.

If i store the formatted_address, it's easy to save, but hard to get the relationship between 2 places. e.g. 2 user may enter the following 2 addresses.

Santa Monica, CA, USA

California, USA

So what information should I save?

enter image description here

Blakes Seven
  • 49,422
  • 14
  • 129
  • 135
OMGPOP
  • 1,995
  • 8
  • 52
  • 95
  • If you want "nearby" then perhaps you should focus on the "geolocation" information ( i.e "geometry" ) contained in the response and store the coordinates, primarily. And thanks for making me squint at another screenshot. Copy and paste the text next time. – Blakes Seven Jul 29 '15 at 11:14
  • All you need, is latitude and longitude. You can perfectly calculate distances, just with lat & lng values. You can make calculations in the SQL. Example (not mongoDB) http://stackoverflow.com/questions/13026675/calculating-distance-between-two-points-latitude-longitude – Emmanuel Delay Jul 29 '15 at 12:52

0 Answers0