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

saving Sites and Observations (inc. photos) for off-network use #15

Open
managingwholes opened this issue Feb 1, 2016 · 2 comments
Open

Comments

@managingwholes
Copy link
Contributor

Thinking ahead to field use, when one is doing repeated observations, having photos and site data saved on device is almost essential, as many sites will be off-network. To accurately repeat photo framing for example, and sometimes transect photos are essential in relocating transects and other observations.

Could the filesystem API be accessed through wq stack? How?

@sheppard
Copy link
Contributor

sheppard commented Feb 2, 2016

Site data should be available offline already via the IndexedDB cache - the maps aren't working, but the data is there. I would envision storing photos in the same place (via wq/store.js), in one of two ways:

  • convert to base64-encoded thumbnails on the server, and add as a read-only field to observations.json. We could then reference the image via e.g. <img src="data:image/jpg,{{base64_data}}">
  • add some JavaScript that downloads the image as binary data and stores it, in a manner very similar to how photos in the outbox are saved and referenced (as Blob objects).

The filesystem is not easily accessible from websites due to security restrictions. You can get at the filesystem from within a PhoneGap/Cordova app, but I think we should be able to do what we need by storing Blobs and/or base64 images in IndexedDB via wq/store.js. The main benefit of the IndexedDB approach is that it works on the web and within Cordova, so we don't need separate code paths for each case. On the other hand, the FileSystem API might better match user expectations and could make integration with other native apps easier.

(For browsers that don't support IndexedDB, the localForage library that powers wq/store.js will automatically use WebSQL or localStorage, as appropriate).

@managingwholes
Copy link
Contributor Author

Would be great to be able to download a few observations into some kind of Stored Observations bin, viewable on the device via the app perhaps with a read-only template, with the ability to attach child observations to them.

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

No branches or pull requests

2 participants