parkerziegler/cartokit

feat: Add support for data uploads.

Closed this issue · 1 comments

We need a way for users to upload data! This should ideally be supported in two ways:

  1. A modal-based flow that requests information from users necessary to populate the layer in the CartoKitIR. This would primarily be to request file uploads or API endpoints for remotely hosted data sources.
  2. A "upload anything" drag-and-drop interaction a la Felt.

For now, we'll restrict data uploads to be fully client-side operations in a Web Worker; chewing through large datasets will be a scaling challenge to tackle later.

  • Add UI for requesting an API endpoint from a user to support remotely hosted datasets.
  • Add UI for requesting a file upload from a user to support local datasets.
  • Perform the file reading in a Web Worker to prevent blocking the main thread.
    • Unfortunately, performing the JSON parsing in a Web Worker won't necessarily help with performance. We still have the cost of serialization when we transfer the JSON back to the main thread. A potential alternative would be to experiment with using ArrayBuffers, which are transferable objects. However, let's wait to see how much of a problem performance ends up being before spending time on implementation here.

Closing for now as the work for this was mostly completed in 1350889. If we need to do more sophisticated tricks with data uploads, we'll tackle those in a separate issue.