Repository navigation
Conversation
|
Can you please update this to master? |
|
Nice, I think it looks good! |
| const tmpElement = document.createElement("a"); | ||
| const file = new Blob([xmlString], {type: 'application/gpx+xml'}); | ||
| tmpElement.href = URL.createObjectURL(file); | ||
| let date = new Date(); | ||
| tmpElement.download = `GraphHopper-Route-${Math.round(path.distance / 1000)}km-${date.getUTCFullYear()}-${pad(date.getUTCMonth() + 1)}-${pad(date.getUTCDate())}.gpx`; | ||
| tmpElement.click(); |
There was a problem hiding this comment.
Creating an anchor element and programatically clicking on it doesn't look like the standard way to download a file, but ok :D ... or maybe it is :)
There was a problem hiding this comment.
Yes, I thought so too, but I couldn't find any other example for such a dynamic case :(
There was a problem hiding this comment.
We could use a library like this: https://github.com/eligrey/FileSaver.js
There was a problem hiding this comment.
Ah, but they use the same procedure it seems :)
https://github.com/eligrey/FileSaver.js/blob/master/src/FileSaver.js#L74
* use more descriptive button * initial version of GPX export * mostly css tuning
Fixes #18 via some minor client code to convert the JSON into GPX.
The layout had to change to have two buttons per route row, which IMO looks slightly better now even overall.