mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 11:06:40 +07:00
gpx fix
This commit is contained in:
parent
99f76dbe2c
commit
bcc357ca98
1 changed files with 17 additions and 2 deletions
|
@ -17,14 +17,29 @@ export const getGPXString = ({ points, title }: IGetGPXString): string => (`
|
||||||
<name>${title || 'GPX Track'}</name>
|
<name>${title || 'GPX Track'}</name>
|
||||||
${
|
${
|
||||||
points.reduce((cat, { lat, lng }, index) => (
|
points.reduce((cat, { lat, lng }, index) => (
|
||||||
`${cat}
|
` ${cat}
|
||||||
<rtept lat="${lat}" lon="${lng}"></rtept>`
|
<wpt lat="${lat.toFixed(6)}" lon="${lng.toFixed(6)}"></wpt>`
|
||||||
), '')
|
), '')
|
||||||
}
|
}
|
||||||
</rte>
|
</rte>
|
||||||
</gpx>
|
</gpx>
|
||||||
`);
|
`);
|
||||||
|
|
||||||
|
// export const getGPXString = ({ points, title }: IGetGPXString): string => (`
|
||||||
|
// <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
// <gpx>
|
||||||
|
// <rte>
|
||||||
|
// <name>${title || 'GPX Track'}</name>
|
||||||
|
// ${
|
||||||
|
// points.reduce((cat, { lat, lng }, index) => (
|
||||||
|
// `${cat}
|
||||||
|
// <rtept lat="${lat}" lon="${lng}"></rtept>`
|
||||||
|
// ), '')
|
||||||
|
// }
|
||||||
|
// </rte>
|
||||||
|
// </gpx>
|
||||||
|
// `);
|
||||||
|
|
||||||
export const downloadGPXTrack = ({ track, title }: { track: string, title?: string }) => (
|
export const downloadGPXTrack = ({ track, title }: { track: string, title?: string }) => (
|
||||||
saveAs(
|
saveAs(
|
||||||
new Blob([track], { type: 'application/gpx+xml;charset=utf-8' }),
|
new Blob([track], { type: 'application/gpx+xml;charset=utf-8' }),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue