Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tap in map to add restroom here (using lat+lon => street address API) #73

Closed
Leffe108 opened this issue Mar 8, 2019 · 5 comments
Closed

Comments

@Leffe108
Copy link

Leffe108 commented Mar 8, 2019

Scope / difficulty

UI + lookup address from lat+lon

Impact

Simplify contributing locations.

Rationale

Personally I stop trying to contribute when the form ask me to enter the street name of a place when I just have zoomed in the map on the place and then switched to the contribution form. I have no clue what street name + address to enter in order for the map marker to end up at the right place, but I can easily longpress/tap on the map where I want to have it.

Proposal

I propose in the app that you should be allowed to tap or longpress on a location and the app would place a map marker there and show a popup with a button/link saying "add restroom here" which if I tap it would open the contribution form and filling out all location data for me using APIs for finding the street name from latitude and longitude. Mapbox have for example 50 000 free geocodings per month, and maybe they or some other provider would sponsor the project if a higher quota is needed.

How to actually do this:

I don't know the code of the app, but I have worked both with Leaflet and OpenLayers and quite a bit with location data. It looks though that you are using Google map tiles and probably also Google maps client. So this is more on high level than specific for the project source code.

  1. Register tap/longpress callback in the map solution in the app.
  2. Make a request to the geocoding API possible via a proxy on the rails server to keep the geocoding API key private
  3. Show a backdrop + spinner
  4. When the requset resolves, hide backdrop+spinner
  5. Navigate to the Add Bathroom view and pass along latitude+longitude and resolved address as view parameters.
  6. Fill out resolved address in the form and latitude+longitude in hidden form fields so that when submitted, the database will use this latitude+longitude as geolocation and not resolve it from the address.

An alternative is to first navigate to the Add Bathroom view with only latitude+longitude as view parameters and then call the geocoding API and perhaps disable the location related fields and show a spinner in each of them or ontop of them, or in some other way show that they are being resolved.

If the geocoding API is able to produce multiple street addresses for the user to pick the best one, then it is probably better usability to stay in the map to keep the map context of where you are and display a popup for address selection.

@Leffe108
Copy link
Author

Leffe108 commented Mar 8, 2019

Sorry, call me ignorant, but I now realize there is actually a separate project for web, one for Android and one for iOS. This issue was mostly raised in response to using the Android app. I saw an app folder in this code base and thought you used some ruby based hybrid framework I never heard of as I haven't used ruby in years.

@Leffe108 Leffe108 closed this as completed Mar 8, 2019
@DeeDeeG
Copy link
Contributor

DeeDeeG commented Mar 9, 2019

Hi @Leffe108! Thanks for the suggestion.

If you don't mind, we can move this issue to the Refuge Restrooms Android app repo: https://github.com/RefugeRestrooms/refugerestrooms-android

Regards,

- DeeDeeG

@Leffe108
Copy link
Author

Leffe108 commented Mar 9, 2019

Feel free to move the suggestion to the android project.

@DeeDeeG DeeDeeG transferred this issue from RefugeRestrooms/refugerestrooms Mar 9, 2019
@DeeDeeG DeeDeeG reopened this Mar 9, 2019
@Leffe108
Copy link
Author

Leffe108 commented Mar 9, 2019

  • It looks like the root project RefugesRestrooms/refugesrestrooms does have a JavaScript geocoder created from google.maps.Geocoder.
  • It also looks like the Android App uses a webview that loads the add restroom form from the rails web project.

Thus the probably easiest solution would be to add support for reverse geocoding in the form which reside in the rails project and then invoke that from the Android App by calling into the webview. It also have the benefit that the iOS app could benefit from the initial work and "only" need to duplicate the map UI part assuming it also uses a webview to add restrooms.

@hissingpanda
Copy link
Member

This is more or less resolved with #84

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants