-
Notifications
You must be signed in to change notification settings - Fork 284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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? |
src/DistortableCollection.js
Outdated
} | ||
|
||
function downloadFromLocalStorage(getImages) { | ||
var obj = localStorage.getItem('locations'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
|
src/DistortableCollection.js
Outdated
|
||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exciting to see this function get completed!!
Hello @jywarren, per our discussion here are the changes UI Changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 test
If tests do fail, click on the red
X
to 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