Skip to content

GPX Support - #212

Merged
karussell merged 5 commits into
masterfrom
gpx
Sep 5, 2022
Merged

karussell merged 5 commits into
masterfrom
gpx

Conversation

@karussell

Copy link
Copy Markdown
Member

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.

@easbar easbar changed the title GPS Support GPX Support Sep 5, 2022
@easbar

easbar commented Sep 5, 2022

Copy link
Copy Markdown
Member

Can you please update this to master?

@karussell karussell added this to the 0.4 milestone Sep 5, 2022
@easbar

easbar commented Sep 5, 2022

Copy link
Copy Markdown
Member

Nice, I think it looks good!

Comment on lines +99 to +104
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();

@easbar easbar Sep 5, 2022 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I thought so too, but I couldn't find any other example for such a dynamic case :(

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@karussell
karussell merged commit 5aa89a7 into master Sep 5, 2022
@karussell
karussell deleted the gpx branch September 5, 2022 11:19
ZeroGxMax pushed a commit to minhhpkp/graphhopper-maps that referenced this pull request Nov 12, 2024
* use more descriptive button

* initial version of GPX export

* mostly css tuning
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

Successfully merging this pull request may close these issues.

gpx support

2 participants