Download json file of saved positions #1237
Conversation
|
@jywarren, please review my pr! For now I'm trying to make the downloaded file more readable. |
|
hi @jywarren , I was trying to make the JSON pretty, with JSON.stringify( obj, undefined, "\t")(Also, tried null instead of undefined). Usually this works but it's not showing any tabs in downloaded file, rather it's showing "\t" . Is their anything else I can try? |
| } | ||
|
|
||
| function downloadFromLocalStorage(getImages) { | ||
| var obj = localStorage.getItem('locations'); |
There was a problem hiding this comment.
Per our conversation, after generateExportJson() is changed, we can just do this!
| var obj = localStorage.getItem('locations'); | |
| var obj = generateExportJson(true); |
|
OK, resuming here, we want to add a default if (allImages || this.isCollected(layer)) {Leaflet.DistortableImage/src/DistortableCollection.js Lines 192 to 197 in c80a7c6 |
|
|
||
| function downloadFromLocalStorage(getImages) { | ||
| var obj = localStorage.getItem('locations'); | ||
| var data = 'text/json;charset=utf-8,' + encodeURIComponent(JSON.stringify(obj, prettyJson)); |
There was a problem hiding this comment.
From here down is what you want. Let's just connect it to a button! And we can probably skip the prettyJson below - could do it later with a library!
|
Referencing this function could work like: document.getElementById('export').onclick = function() { map.imgGroup.generateExportJson(true); } |
…leImage into vanithaak-downloadJSON
…leImage into vanithaak-downloadJSON
…istortableImage into vanithaak-downloadJSON
|
Hello @jywarren, I've been able to integrate the downloadJSON trigger in the UI Changes |
jywarren
left a comment
There was a problem hiding this comment.
Exciting to see this function get completed!!
|
Hello @jywarren, per our discussion here are the changes UI Changes |
jywarren
left a comment
There was a problem hiding this comment.
This looks super. Great work!!


Fixes #998 (<=== Add issue number here)
Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!
grunt testIf tests do fail, click on the red
Xto learn why by reading the logs.Please be sure you've reviewed our contribution guidelines at https://publiclab.org/contributing-to-public-lab-software
Thanks!
GIF
MapKnitter.Lite.-.Google.Chrome.2022-10-26.01-34-40.1.mp4
Screenshot