nrenner / brouter-web

Web client for BRouter, a routing engine based on OpenStreetMap
https://brouter.de/brouter-web/
MIT License
371 stars 73 forks source link

Ease route sharing: add QR code? #329

Closed EssBee59 closed 4 years ago

EssBee59 commented 4 years ago

Hello, the Brouter-web becomes more and more powerfull and easy to use! But, after creating a tour, users with limited IT experience have to learn how to distribute the generated GPX file (as example to friends or to there own smartphones).

Today the users ob Brouter-web use after a tour creation the export fonction which downloads the generated gpx file. After that, IT knowledges (download storage location or the usage of a file-manager) are prerequisite to "distribute" this file.

If the gpx file is automaticaly copied to the clipboard during/after download, the basic IT knowledges are reduced. (as example, he creates a mail "as usual" with his favorite mail programm and insert the gpx from the clipboard before sending) This solution is easy but also generic, as it can be used with quite any programm on the PC (mails every kind or others) Ess Bee

rkflx commented 4 years ago

I wonder what happens after the mail has been sent: At some point you do have to save to a filesystem on the receiving side anyway, don't you?

Wouldn't it be enough to just send over the route's URL? Then editing is still possible, and the receiver can save the GPX locally. This workflow could serve as a free promotion for BRouter-Web at the same time, so it might even be worth adding a dedicated share/copy button for that (see also #299).

rkflx commented 4 years ago

One more thing: Saving the download location to the clipboard sounds like a generic browser feature, maybe there is an extension for that?

Also, both Firefox and Chromium have support for opening the download folder, they even scroll to and highlight the new file. Dragging the download from the browser UI (i.e. toolbar popup in Firefox, bottom bar in Chromium) to e.g. Thunderbird's attachment area is also possible.

EssBee59 commented 4 years ago

Hello Rkflx,

Tank for the idea to send the URL instead of the gpx file itself! A very good / simple solution in a lot of situations that I intend to use in the future.

But this do not help really in lthe case where the user creates the route with brouter-web on the PC and needs the gpx later in his navi-app: You asked: "I wonder what happens after the mail has been sent: At some point you do have to save to a filesystem on the receiving side anyway, don't you?" For my own on my Android, after a simple click on the GPX-attachement in the mail-app the OS open a window with the list of the apps suporting the gpx format... So it is a very easy, powerfull and "open" solution: you click on the app of your choice and that´s all: As examples.. --> choosing a "gxp viewer" you get the gpx displayed --> choosing a navi-app (I am using Osmand) the gpx is imported and becomes ready to be used for navigation

I tested under Firefox the feature "automatically open the file after download": I had to create a programm that send the gpx per.mail. It is well runnig, but not a solution for user with limited experience. Further the send-mail programm is specific for each mail system and not every brwoser support that.

rkflx commented 4 years ago

after a simple click on the GPX-attachement in the mail-app the OS open a window with the list of the apps suporting the gpx format

I see, seems like a nice solution for users navigating on a smartphone. But it's not for everybody: If you want to send it to your cycling head unit or hand-held GPS, you have to save it somewhere first (unless you are willing to use a proprietary cloud-enabled login-only vendor app -- let me know if there is another way I don't know about yet!). I would also guess that some users are syncing via a file sharing service (e.g. Nextcloud) instead of sending a mail to themselves. I mean, sending by mail is a valid use case, but I don't know how common it is for BRouter-Web's user base.

I tested under Firefox the feature "automatically open the file after download"

What I meant was to simply click on the folder icon next to the download in the download popup. It will open the file explorer with the GPX file already selected. From there (or directly from the browser UI) you can drag it to your mail client, or press Ctrl+C to copy the file location to the clipboard. This works with any download, not only for BRouter-Web.


Let me expand on why I'm always a bit hesitant to recommend to add yet another option to the UI (which would need to be the case here, since some users will get annoyed for sure if their clipboard gets overwritten automatically, and for users to discover the feature in the first place): Every UI element and option not only requires developer effort (implementation and maintenance), but clutters the UI and when overdone leads to an unusable spaceship-like cockpit where you cannot find the important buttons among the lesser used ones anymore.

Anyway, that's just my take on it, it's not for me to decide on this feature... Having such conversations is important, though, to understand use cases and to find out what is important and where there are pain points in the UI or feature set.

rkflx commented 4 years ago

To clarify what "copy download path to the clipboard" actually means in the context of a browser:

It might be possible to copy the file's content itself to the clipboard and set an appropriate mimetype for it to be recognized as GPX and (not sure whether this works in browsers too) a filename suggestion. In this case asking for a file path in the beginning is not needed, and pasting depends on whether the receiving application supports mimetypes other than plain text.

Another way to look at this is to copy the server's download path to the clipboard, so there would be no need for the extra step to click on "Export" again.

Again, I don't think this is something for BRouter-Web.

EssBee59 commented 4 years ago

Hello Rkflx,

As explained, the most usefull "use case" concentrates on a way to send the gpx file as mail-attachement; I think, in the future navi-app´s will be used more and more, and it is very confortable to use the mail attachement on the smartphone. But also for proprietray devices, app´s often exist to transfer a gpx from the smartphone to the navi-device using bluetooth (Example "Garmin-connect", wich appears in the list of the apps supporting gpx files when you click on the attachement)

So any help in the brouter-web for sending mails with the gpx as attachement could enhance the acceptance of non experienced users

It seems, a solution for that is not easy, at least in the Web-page. A fat programm on the PC has of course more functionality (as example in Firefox the post-download becomes as argument the full path-name of the gpx C:\Users\MyUserid\AppData\Local\Temp\Tour1-1.gpx and can create a mail automatically with outlook: "C:\Program Files (x86)\Microsoft Office\root\Office16\OUTLOOK.EXE" /c ipm.note /m "my.mail.address@MyMailServer&subject=GPX_File" /a "%1 %2 %3 %4 %5 %6 %7 %8 %9" spaces in the file name requires multiple arguments) )

If no solution appears, feal free to close the request Thank for your help Ess Bee

EssBee59 commented 4 years ago

Further remark: for security reasons it could be better to use bluetooth rather than a mail for sending the gpx file to the smartphone... But till now my transfer failed (gpx file type unknowm ... strange, the format is known on the PC and on the smartphone)

rkflx commented 4 years ago

So, to summarize: Copying a path or sending a mail is just one possible workflow, what you are actually looking for is an easier way to share a route from BRouter-Web, more specifically:

AFAICS there are the following options for sharing from a browser (feel free to add to the list):

  1. file-based sharing (already implemented; enhancing the browser's download dialog or the desktop's file dialog regarding sharing via mail or Bluetooth should be brought up with the respective vendors)
  2. link-based sharing (a separate "Share" button in BRouter-Web's UI could make this function more obvious; this could include a way to copy to the clipboard and to show a QR code to be scanned from a smartphone) (*)
  3. a mailto: link (it seems attaching files using this method is discouraged, so does not really help here)
  4. calling vendor-specific APIs (although BRouter-Web should only promote and integrate with free-software services, IMO)
  5. using a browser extension to bridge the gap between browser and desktop (e.g. there is KDE Plasma's Browser Integration, which "Adds a context menu entry to links enabling you to send them to your phone and other paired devices" and "Let[s] websites prompt for sharing contents to other applications")

Implementing (2) might be the easiest for now.

As for your Bluetooth problem, GitHub's issue tracker is not really the best place to solve it, sorry.


(*) To reduce load on the BRouter server, computation results triggered by download URLs could be cached based on the URL's hash.

EssBee59 commented 4 years ago

Hello Rkflx,

I think, the need (nice to have feature) is now clarified, thank for your big job! My expertise is not good enough to review the different options listed above, or to help in a special direction. Just as remark / question: By the option 2, what appends on the smartphone side after scanning the code, is it then possible to transfer the gpx to a navi-app (or another app) in an easy way?

rkflx commented 4 years ago

By the option 2, what appends on the smartphone side after scanning the code, is it then possible to transfer the gpx to a navi-app (or another app) in an easy way?

It should not differ much from how it is handled in your email app.

Here are some examples for QR codes:

Open route in BRouter-Web, then tap on "Export": open

Download route directly: download

Would it be possible to show the app chooser to open the route immediately in OsmAnd? Yes, but while Content-Type: application/gpx+xml; charset=utf-8 is already set, currently it only triggers a download. I guess Content-Disposition: attachment; filename="..." would need to be removed for this case, but due to other issues (see below) more fixes in mimetype handling in browsers, OsmAnd and/or the QR code scanner might be needed.

PDF test case with Content-Type: application/pdf to trigger the app chooser, works with Document Viewer from F-Droid amongst others: pdf-app

PDF test case with Content-Disposition: attachment to trigger a download: pdf-download

Note that some QR code scanners are having issues, e.g.:

rkflx commented 4 years ago

Open questions and next steps in case the feature is approved and someone is willing to work on it:

Related issues:

nrenner commented 4 years ago

Download route directly

On my Samsung Galaxy with default scanner is seems like the scan isn't successful at first, probably because it's waiting for the response, then it's opening as text in Note.

I'm not sure this is the right approach for passing the track and we probably shouldn't rule out sending the actual track data in some way prematurely.

Adding a QR code for sharing the URL (#299) would indeed be nice, but I feel like this is jumping to a solution too fast.

rkflx commented 4 years ago

Thanks for testing!

Assuming #109 gets fixed, does this workaround for Download route directly work for you?

download-fixed

we probably shouldn't rule out sending the actual track data in some way prematurely.

I'm not sure I understand what you mean by that?

EssBee59 commented 4 years ago

Hello, I scanned the code above with the app "QR & Barcode Scanner"... But I only get a "succesfull download", not a list of the app´s supporting gpx and the possibility to process/import directly. The file is stored in the "download" directory of the smartphone, better as on the PC.... But a soltution with direct processing (gpx viewer) or import into an app (Osmand, Garmin Connect, etc...) would be much better.

nrenner commented 4 years ago

Yes, it's opening the browser and downloads the result with a message that quickly disappears and leaves the user with a blank page - which might be a bit confusing - and a download notification icon in the tray. Opening the download notification and clicking on it opens it with OsmAnd for me, which is nice.

we probably shouldn't rule out sending the actual track data in some way prematurely.

I'm not sure I understand what you mean by that?

Like sending the GPX track as mail attachment or uploading it to a track sharing site or transferring with WebRTC or sending a push notification for data sync, ...

rkflx commented 4 years ago

But I only get a "succesfull download", not a list of the app´s supporting gpx and the possibility to process/import directly.

If you used Firefox to scan the QR code, you'd get the app chooser.

a message that quickly disappears

If you used Firefox to scan the QR code, the message would stay open.

leaves the user with a blank page

Thanks for bringing this up. If you are willing to spare an extra click or tap (which was frowned upon in an earlier comment), instead of having separate links/QR codes for viewing the route in BRouter-Web and downloading, there could be a single link/QR code for an intermediary landing page, offering:


Anyway, since most of the issues stem from third-party apps which are hard to fix, and I'm not interested in uploading tracks to external sites or to build yet another syncing app, I'll leave it at that and focus my efforts elsewhere. Thanks for your feedback so far, it has been appreciated!

nrenner commented 4 years ago

Sorry if that came accross as criticism and I didn't mean to hold you back. If you're interested in implementing a QR code solution then go ahead, as said it's definitely a nice way of getting a route link onto the smartphone.

I guess my point is that there might be reasons not to send a download link that calculates the route at the time it is received/clicked, especially in the case of sharing with others, but to freeze the result in the form of a formatted track at the time of sending.

I'm currently thinking about changing the way we download and format tracks because of #68 and I'm going to open a new issue about this. It might well be that we switch to merging and formatting the segments we already have in the client and/or to support additional formats like FIT (#322) by the client only.

EssBee59 commented 4 years ago

Hello Rkflx

I retested to scann the last posted qr code above using the pre installed scanner & browser on my Xiaomi Smartphone... And I could "open" the gpx file without file-manager or knowledge of the file path! 4 clicks are necessary, but with a very short instruction and without installing new app´s, users would be able to use the gpx file on their phone in the way / with the app they prefer!!!!!

It would be very nice to get this feature: I think, Brouter + brouter-web are the best routing system, in term of fonctionality and flexibility... But the success of a product is also measured by the number of users. Such a feature would help grantly the mass of users, as it much beter integrates the Brouter-web in the smartphone world.

Anyway, thank for your brain storming I am not really a developper, but if necessary I can help where possible (support, test etc...) (Currently I am working on an extention of the interface "Osmand and brouter-app), hope to get help from Arndt..)

@ nrenner: Norbert, I think, the load of the server (at least for the Brouter Process) would not really grow by introducing this feature: Curently the request to the brouter for generating the gpx is posted from the brouter-eeb when the user starts the export.... If the user decide in the future to use the scann feature, the same request to brouter wil be initiated from the smartphone and will produce the same load..

The point "sharing with others": The solution proposed by rkflx (sending the final URL from Brouter-web) could generate more load, but I think, this is not the top use case, and not every user is able to copy the URL manually into a mail. Do you have another idea to share (as e. sending the qr code as pdf)?

EssBee59 commented 4 years ago

Hello,

Curently and using the standars scanner-aps on the smartphone to read the QR-Code, many steps (and activity switches) would be necesary untill the gpx can be opened from an app... not really easy for anybody.. I created and tested this week a simple stand-alone Android-app which integrates all the steps (Scann + Download + Open). So far, the solution proposed by Rkflx using QR Codes could become very confortable!!!
(after a short discussion with my bike-friends each of them liked to have the solution ASAP)

nrenner commented 4 years ago

Regarding the original request, I was curious if changing the way we download would offer more direct options for copying to clipboard and/or dragging.

Currently we don't get hold of the download data, as the browser is handling the response with the Content-Disposition header. The idea is to fetch the data ourselves in a previous step and to provide a link with a download attribute and a Blob URL with URL.createObjectURL() for downloading from the client.

Here I made some tests based on that: https://plnkr.co/edit/0UDpLXJVQVOE6qRc?open=lib%2Fscript.js&preview

I might have missed something or be doing it wrong, but this approach doesn't seem helpful here.

EssBee59 commented 4 years ago

Hello Norbert,

Sorry, my expertise is not good enough to follow your reseach (is your goal to create a mail containing a link or to load the link in the clipboard? J Just an info / remark about content and mime-type: By creating my small app using examples found in the web, I discoverd that after the "file-download" the "open" file was not based on the file extention (.gpx) but on other parameters... (in a first version I forgotted to add the .gpx extention in the file name, but the open was OK Android proposed the GPX compatible app´s in the same way as when I click a .gpx file from aa mail attachement or from a file-manager) If you are interested, I can send you the code Regards

nrenner commented 4 years ago

is your goal to create a mail containing a link or to load the link in the clipboard?

Neither. Copying a link to the clipboard is possible, but I was referring to the issue title "copy the gpx file to the clipboard". So the goal would have been to copy or drag the actual GPX data in a way that it can be pasted or dropped as an embedded object or attachment to a mail or maybe to a chat app that has a web client and supports sending documents.

As rkflx already mentioned, dragging to a mail after the download is possible, but completely handled by the browser and operating system, we don't have any control of that. A similar option in the web app itself would have been a bit more direct and guided, but apparently web apps are not able to do that (yet).

Sorry, my expertise is not good enough to follow your reseach

You could test if any of those options would work for you (but probably not), here is a link to the test page only: https://run.plnkr.co/preview/ckdugiggs0007246d9jct3lnq/

I created and tested this week a simple stand-alone Android-app which integrates all the steps (Scann + Download + Open).

Might be interesting to integrate that in the BRouter app, but that's not on me to decide.

EssBee59 commented 4 years ago

Hello,

I think, the goal of my request is now well understood: Unexperimented PC users should be able to transfer a created tour (GPX) to their smarphone in an easy way!

My first idea was to transfer using a mail, but there is too much different mail applications... That for I thought using the clipboard....

But RKFLX proposed I think the best solution with the use of QR Codes!!!!!!!!!! This is really GENERICc and supported by every smartphone... Secondly, the solution is OPEN, as it addresses every GPX capable app on the phone...

Last week I created this small app to integrate the scanning + downloading + opening of the GPX.. (if Arndt agree, an integration in brouter-app is possible)

This week, I created on my local brouter-web installation a prototyp (proof of concept) for "QR Code" generation: (Currently, instead of downloading, I open in the "export.js _export: function) a new window where to show the QR Code of the download-url)

I think, the prototyp runs very well. Of course an integration remains necessary, as example a second button should be created in the export-box.

If no better solution as QR Code is found, I hope this solution will be implemented / commited by the brouter-web team. Of course, if you are interested I can document my prototype: it is based on a very small change in export.js, addition of an html page containing a javascript which create the QR Code using QRCode.min.js)

Regards

EssBee59 commented 4 years ago

Hello bagage,

Thank for the change wich make sense...

I just created a new request as replacement for this, of course with a better title !!! https://github.com/nrenner/brouter-web/issues/332

So I think we can close this one?

Regards

EssBee59 commented 4 years ago

As explained, for a better overview I replaced this request with the new request #332

And close this now!

(it can by need be reopened!) Regards