Skip to content
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

MapKnitter Lite: fetch images from Internet Archive #998

Open
16 of 21 tasks
jywarren opened this issue Jul 12, 2022 · 10 comments · Fixed by #1158, #1175, #1237 or #1293 · May be fixed by #1225
Open
16 of 21 tasks

MapKnitter Lite: fetch images from Internet Archive #998

jywarren opened this issue Jul 12, 2022 · 10 comments · Fixed by #1158, #1175, #1237 or #1293 · May be fixed by #1225

Comments

@jywarren
Copy link
Member

jywarren commented Jul 12, 2022

This is for an idea for a static-served MapKnitter Lite.

Sketches of how this could look: https://docs.google.com/presentation/d/1kFXK0f3h2IsA2lml9L2s_REXm5p1ZGAVqfKUb9H_8Eo/edit?usp=sharing

N.B: To use MapKnitter Lite successfully, users must first upload their images to the Internet Archive and get a unique identifier or URL (for their image collection)

Guide to uploading images on Internet Archive: https://help.archive.org/help/uploading-a-basic-guide/

How to make a map:

Smaller issues

  • add a loading spinner on the "Place" buttons so people know it's still loading the image after you press it; check presence of image.width to confirm it's finished loading (i think this is the right shortcut to check image load completion?) Added spining icon for place on map button #1169
  • load image thumbnails in sidebar instead of full images (we should be able to tell from the Archive's collection response which are thumbnails) so we don't overload with a huge image collection load image in sidebar as thumbnail  #1319

Ways to save the map:

  • maps would still be exportable using our cloud exporter
  • saving the positions in localStorage
  • allowing download of the positions as a JSON file Download json file of saved positions  #1237
  • maybe generating a SVG of the map using the positions and client-side webgl-distort?
  • accepting a JSON file by URL or upload to load a map
  • detecting a JSON file that's dragged onto the map, and loading the images and centering them in the viewport
  • you could share the map by sharing a URL like: https://lite.mapknitter.org/#https://example.com/my-map.json if you're able to save the JSON file online. We could offer that on PL.org.

Bonus/stretch:

Code to fetch a gallery (CORS is now enabled for IA images):

$ $.get('https://archive.org/metadata/texas-barnraising/',function(response) { console.log(response) })
{readyState: 1, getResponseHeader: ƒ, getAllResponseHeaders: ƒ, setRequestHeader: ƒ, overrideMimeType: ƒ, …}
=> VM8221:1 {created: 1657632500, d1: 'ia600904.us.archive.org', d2: 'ia800904.us.archive.org', dir: '/27/items/texas-barnraising', files: Array(25), …}

$ i = new Image; i.src = "https://archive.org/download/texas-barnraising/IMG_0764.JPG";
=> 'https://archive.org/download/texas-barnraising/IMG_0764.JPG'
// will be at https://ia801507.us.archive.org/34/items/texas-barnraising/IMG_0764.JPG

$ i.width
=> 2592

This idea was explored in our GSoC ideas list here: https://publiclab.org/wiki/gsoc-ideas#MapKnitter+Local with the extra ideas:

Later projects/stretch goals

Something to bear in mind if you all make a lot of progress and are looking for things: #474 this issue gets at the relatively complicated external map exporter service, and it's not very well documented. If we could document it better that might go hand in hand with the local full-res map exporting mentioned above. -- @jywarren

@jywarren
Copy link
Member Author

Uploading isn't so bad; i named this one texas-barnraising: https://archive.org/details/texas-barnraising

Screen Shot 2022-07-12 at 10 04 26 AM

@jywarren
Copy link
Member Author

jywarren commented Aug 12, 2022

Just as a proof of concept, I found that static copies of MapKnitter.org in the internet archive are mostly functional:

https://web.archive.org/web/20220726175945/https://mapknitter.org/maps/ceres--2/edit

Pretty encouraging actually!

image

I even tried selecting the images and generating an export, but unfortunately the export URL is also rewritten to be an archived page: https://web.archive.org/web/20211003004105/http://export.mapknitter.org/export

If we could get it to generate an external request, people could still work on old MapKnitter pages, and export what they do, interesting! They wouldn't save online though.

Maybe a more useful thing would be that we might think about how to accept JSON files in the format which MapKnitter serves them. Those are still backed up on the Internet Archive, so we could continue using them:

https://web.archive.org/web/20220726175911/https://mapknitter.org/maps/ceres--2/warpables.json

[
{"id":306187,"parent_id":null,"image_content_type":"image/jpeg","image_file_name":"DJI_1207.JPG","thumbnail":null,"image_file_size":8148349,"width":3968,"height":2976,"created_at":"2019-02-22T05:56:05.000Z","updated_at":"2019-02-27T23:13:21.000Z","map_id":13015,"nodes":[
 
 {"id":2593754,"color":"black","author":"anonymous","lat":"-37.7664063648","lon":"144.9828654528","way_id":0,"order":0,"created_at":"2019-02-27T23:13:20.000Z","updated_at":"2019-02-27T23:13:20.000Z","name":"","description":"","map_id":0,"way_order":0,"body":null},
 
 {"id":2593755,"color":"black","author":"anonymous","lat":"-37.7650239004","lon":"144.9831980467","way_id":0,"order":0,"created_at":"2019-02-27T23:13:20.000Z","updated_at":"2019-02-27T23:13:20.000Z","name":"","description":"","map_id":0,"way_order":0,"body":null},
 
 {"id":2593756,"color":"black","author":"anonymous","lat":"-37.7652020107","lon":"144.9844533205","way_id":0,"order":0,"created_at":"2019-02-27T23:13:20.000Z","updated_at":"2019-02-27T23:13:20.000Z","name":"","description":"","map_id":0,"way_order":0,"body":null},
 
 {"id":2593757,"color":"black","author":"anonymous","lat":"-37.7665844718","lon":"144.9841207266","way_id":0,"order":0,"created_at":"2019-02-27T23:13:20.000Z","updated_at":"2019-02-27T23:13:20.000Z","name":"","description":"","map_id":0,"way_order":0,"body":null}
],"locked":false,"deleted":false,"history":"","cm_per_pixel":4.99408,"src":"https://web.archive.org/web/20220726175911/https://s3.amazonaws.com/grassrootsmapping/warpables/306187/DJI_1207.JPG","srcmedium":"https://web.archive.org/web/20220726175911/https://s3.amazonaws.com/grassrootsmapping/warpables/306187/DJI_1207_medium.JPG"}
...
]

Not all of those attributes are needed for exporting; in fact, just the src, cm_per_pixel and nodes array with latitude/longitude coordinates are required, just like in this exporter JSON format:

https://github.com/publiclab/image-sequencer-app#usage

Name and description could be nice too, but optional.

@Dhei-vid
Copy link

I want to contribute to this

@Dhei-vid
Copy link

I'd like to work on the drag image onto page to add feature @jywarren

@jywarren
Copy link
Member Author

Hi @Dhei-vid - thank you, i do have a worry about that. Generally we are aiming for a system where you can download a 'saved' version of the map. But if we allow people to drag an image in, that image won't be readable by anyone else (since there is no server-side file storage to keep the image, it's just displayed locally to the person who dragged it, nobody else). So if we allow people to mix in locally dragged images, it could break share-ability of maps.

I'm not sure what the solution is. I think it's complex and needs an issue to itself to discuss. Can you open one like "discuss design of dragged-on local images for MapKnitter Lite" and we can work through the questions there? For example, we could just warn people that some images won't be save-able. Or we could not allow dragging images, but prompt people to add the images to an Internet Archive collection. Maybe there are other possibilities too. Let's discuss in a new issue!

@Dhei-vid
Copy link

Okay @jywarren

@Jolzyfx
Copy link

Jolzyfx commented Oct 20, 2022

@jywarren please can i be assigned this issue

@Jennifer-tech
Copy link
Contributor

@jywarren please can I be assigned an issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment