Street Map Generator
📖 Overview
Street Map Generator is a Python-based automation tool that can generate high-resolution city map mosaics.
It uses Selenium to automatically navigate Baidu Maps at specific coordinates, capture screenshots of urban areas, crop them precisely, and merge them into one complete stitched map.
This tool can be used for:
- City visualization and topographic studies
- Urban planning or UI prototyping
- Background map generation for data visualization
- Simulation environments for robotics or autonomous systems
Click HERE to go to the project.
See SHANGHAI.png as an example. The picture without blackline can serve as an example.
🧩 Features
- 🌐 Automated map capture using Selenium and ChromeDriver
- 📸 Precise image cropping with OpenCV to remove browser frames
- 🧱 Automatic image stitching via Pillow
- ⚙️ Configurable coordinate range and resolution
- 🧮 Extensible coordinate base for different cities (e.g., Shanghai, Suzhou)
🧠 File Descriptions
| File | Description |
|---|---|
get_pic.py |
Main script — handles map fetching, cropping, and stitching |
visit.py |
Early version for coordinate-based automated browsing |
click_test.py |
Mouse coordinate debugging tool for calibration |
🧰 Dependencies
Install required packages via pip:
1 | |
You will also need:
- Google Chrome
- ChromeDriver (version must match your Chrome browser)
⚙️ Usage
1️⃣ Set Parameters
In get_pic.py, adjust parameters such as base coordinates and step size:
1 | |
2️⃣ Run the Program
1 | |
The script will:
- Automatically open Chrome and navigate to target coordinates
- Take screenshots and save them to
pics3/ - Automatically stitch them into one large image, e.g.
Suzhou.png
🖼️ Output Example
The final resolution depends on the number of rows and columns as well as image dimensions.
Example: with 19 × 41 tiles of 1236×706 pixels → about 23,484 × 28,946 px stitched image.
⚠️ Notes
- Excessive requests may trigger anti-bot mechanisms — use random
sleep()delays. - The script will open many browser windows; do not close them manually.
- Works best on Windows (uses
win32apiandctypes.windllfor mouse control).
Mac/Linux users need to replace mouse-related calls.