سؤال

For an online ordering system, we figured that we would take the entered address and city, calculate the distance between it and each entry in a database of addresses using the Google Maps API.

However the client was told by his previous designer that he needs to use geotargeting for more accuracy. As far as I know, geotargetting is only accurate in getting the user's country, but definitely not precise location.

Is there a problem with the address+city method? And is there any truth to the geotargetting method?

هل كانت مفيدة؟

المحلول

Geo-targeting will provide you with the precise location (coordinates) of the user, if they choose to share it.

You can use the coordinates with Google Maps API to then calculate the distance in the same manner you planned with address of the user or the restaurant. (Google converts any address to a coordinates in it's calculations.)

There is no problem with your address+city method, but it may be easier for users to just share their current location... and not have to enter a current address+city.

Address+city would need to be a fallback if the user is not willing to 'share their current location' via geo-targeting.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top