Generate a COCO File from Google Drive

Background

Assess Images projects are created from a COCO-format JSON file describing the images to be mapped. This page provides a Google Apps Script that produces a minimal COCO file ({ "images": [...] }) from a folder of images hosted on Google Drive, so they can be referenced by public URL.

Caution

Ongoing updates to MapSwipe and Google Drive may render this script out-of-date.

Utility script: generate_coco_from_drive.js

For the Dropbox equivalent see Generate COCO File from Dropbox.

Prerequisites

  • A Google account.
  • Your image files stored in a public Google Drive folder.
  • Access to Google Apps Script at https://script.google.com.

Creation Steps

  1. Create a Google Apps Script project.

  2. Paste the utility script.

  3. Replace placeholder values.

    • Replace your_coco_export.json with your desired output filename.
    • Replace your_public_folder_id with the ID of your Google Drive folder.

    The folder ID is the alphanumeric string that appears after /folders/ in the URL. Example: drive.google.com/drive/folders/1prcCevijN5mubTllB2kr5ki1gjh_IO4u?usp=sharing

  4. Run the script.

    • Save the project using the floppy-disk 💾 icon.
    • Press Run.
    • Accept the authorization prompts the first time you run the script.
  5. View the COCO JSON output.

    • Go to View → Logs.
    • Copy the Google Drive URL where the COCO file was generated.
    • Download the JSON file.