A lightweight Python utility built with OpenCV to create interactive hotspot areas and automatically generate the corresponding JSON configuration for Interactive VC Maps. This tool enables you to edit the existing hotspots defined and edit it accordingly. This tool replaces the previous two-step workflow (using external image map tools + manual JSON formatting) with a single draw-and-export process.
The main application file is:
- map_picker.py
interactive-vc-map-json-util/
├── images/ # Source map images (.jpg)
├── output/ # Generated JSON files
├── map_picker.py # Main application
├── requirements.txt # Python dependencies
└── README.md
Setup & Installation (Ubuntu 24.04 Recommended)
- If not already, create and activate virtual environment
source venv/bin/activate-
Install dependencies
pip install opencv-python -
Running the Tool
python map_picker.pyYou will be prompted for:
- Image file name (must exist in ./images/)
- Brand name (used in the generated JSON title)
Inside the OpenCV window:
Drag → draw new rectangle (Draw mode)
d → delete mode (click inside rectangle to delete)
m → modify mode (click rectangle to edit title & credential)
n → return to draw mode
u → undo last added rectangle
s → save JSON
q → quit (prompts to save if changes detected)
- Place your .jpg map inside /images
- Run map_picker.py
- Draw hotspot rectangles
- Enter title + sample credential
- For title, ensure you start with "DFR, DCC, DPP, DTE". For example: "DFR - Facility Record - Location M"
- For sample credential, fill in the issued credential
- Modify/delete if needed
- Press s to save
- JSON is ready for use in the Interactive VC Map
Previously:
- Use external image map generator
- Copy coordinates manually
- Manually format JSON
- Risk formatting mistakes
Now:
- Draw → Enter details → Save
- JSON generated automatically
- Faster, cleaner, and less error-prone
- Python 3.10+
- OpenCV (opencv-python)
Output is automatically saved to:
./output/<image_name>.json
Created by Karina Liauw, in collaboration with ChatGPT and Grok.