code-for-chapel-hill / NC-COVID-Support

Community support site, supporting COVID-19 business opening hours, Food Banks, School Meals, Farms and Social Services.
https://nccovidsupport.org
GNU General Public License v3.0
16 stars 39 forks source link

Add a "get directions" link out to Google Maps, to appear below the address #243

Closed KM-Hanson closed 4 years ago

KM-Hanson commented 4 years ago

@eparadise Leaving this to you :) The one trick here is we might only apply it to the map-based resources, and not the list-based resources.

readingdancer commented 4 years ago

We could do what the bay area have done and just link on the address, but this does not give you a proper link to the business on Google Maps.

For this to work properly we need to add an additional field to our records that will allow us to link directly to the business, happy for this ticket to implement the address method, but I think we should aim for a better integration afterwards.

readingdancer commented 4 years ago

I suggest we add Google, Apple Maps and Waze

Here is the info for Waze: https://developers.google.com/waze/deeplinks

KM-Hanson commented 4 years ago

@readingdancer Can we start with just one re-direct to Google maps, and see how the user experience feels?

To make it work, can we start by redirecting to Google maps based on the lat/lon instead of the address? That might help avoid the navigation picking up the wrong business name, etc. We still might have mistakes, but that should help, yes?

Agreed that we can add better functionality for Phase 2.

readingdancer commented 4 years ago

For Google Maps, the most accurate way of doing this is to pass in the Place ID's as Waypoints:

https://www.google.com/maps/dir/?api=1&destination=Breakaway&destination_waypoint_id=ChIJJa59whfBrIkR7YQiZwLbbBU

We can find the place ID's by using the following page:

https://developers.google.com/places/place-id

This is not part of the scope of this ticket and is really a data entry task.

For now, I suggest we do the following request to navigate to a long / lat location:

https://www.google.com/maps/dir/?api=1&destination=35.784911,-79.0982256

readingdancer commented 4 years ago

Just to complete the set, the Apple Map instructions are here:

https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html

Now even if we don't implement them all, we can at least refer back to this ticket :)

eparadise commented 4 years ago

@readingdancer I implemented a get directions link for the meal mapper project, and I went by the address instead of the lat/long. I think that might be a better user experience because then at least when they see the pin in Google Maps they see the address it's directing to. What do you think?

readingdancer commented 4 years ago

@eparadise - As long as the coordinates are correct, when you do the search Google automatically puts the closest address into the search box.

readingdancer commented 4 years ago

Try this for example: https://www.google.com/maps/dir/?api=1&destination=35.8213371,-79.0866759

I just thought this would guarantee that we always linked to the right location, instead of Google potentially returning the wrong address if it didn't recognize it.

I don't mind either way, as long as it works. It will hopefully not be used for long, as I'd like us to use the Place ID's so we accurately link to the business.

readingdancer commented 4 years ago

For reference: https://fontawesome.com/icons/google?style=brands https://fontawesome.com/icons/waze?style=brands https://fontawesome.com/icons/apple?style=brands

I think the Waze and Apple icons are recognizable, but I am thinking it might be better to get the official icon from Google and maybe also from Apple ( if / when we add it )