Skip to content

About

Scene boundary visualizer — filter, query and map scene boundaries across provinces and mobile network operators (Flask + Shapely + Tianditu) | 场景边界可视化查看器:多省份多运营商边界的筛选、查询与地图展示

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Scene Viewer

English | 简体中文

A visual browser for scene boundary data — POIs, residential communities and other geographic areas. Built on Flask + Shapely + Tianditu (天地图), it filters, queries and renders vector boundaries across multiple provinces and mobile network operators.

This repository is the open-source edition of the internal VisualArea tool. The internal account system and database credentials have been stripped out. With no database configured it automatically starts in offline mode, using bundled administrative-boundary data, so the full UI can be demonstrated without any setup.

Features

  • Boundary visualization — Tianditu basemap with vector boundary overlay
  • Multi-level filtering — province → city → district → scene type → scene name / ID
  • Multi-operator — China Mobile (dw_area_mobile), China Unicom (dw_area_unicom), China Telecom (dw_area_telecom) and system (dw_area_system) tables
  • Flexible queries — single-condition and multi-scene batch queries, WKT boundary parsing
  • File upload — parse and display uploaded boundary files (CSV / SHP)
  • Responsive UI — usable from both desktop and mobile browsers
  • Offline mode — runs on bundled static data with no database, for full UI demos

Quick start

Option 1 — offline mode (no database required)

# Install dependencies
pip install flask pandas shapely psycopg2-binary

# Start (offline mode, no configuration needed)
DISABLE_AUTH=1 python scene_viewer_lite.py --web --port 5000

Then open http://localhost:5000.

Option 2 — connect to PostgreSQL

Create db_config.json (see db_config.example.json):

[
  {
    "host": "db-host",
    "port": 5432,
    "user": "user",
    "password": "password",
    "databases": ["hubei", "fujian"]
  }
]

The environment variable DB_CONFIG_JSON and the user-level path ~/.scene_viewer/db_config.json are also supported.

Expected table schema

Operator Table Notes
China Mobile dw_area_mobile Scene boundaries; boundaries encoded as lng_lat;lng_lat
China Unicom dw_area_unicom Same
China Telecom dw_area_telecom Same
System dw_area_system System scene table

Two conventions matter when supplying your own data:

  • boundaries uses a custom lng_lat;lng_lat; string encoding rather than standard WKT.
  • The schema stores one boundary per row — MultiPolygon is not supported, so a scene with several disjoint boundaries must be stored as several rows.

Project layout

├── scene_viewer_lite.py        # Main program (single-file Flask app)
├── provinces_cities.json       # Province / city list cache
├── provinces_area_types.json   # Scene type list cache
├── provinces_zones.json        # District list cache
├── provinces_type_counts.json  # Scene type statistics cache
├── provinces_admin_areas.json  # Administrative boundary data
├── db_config.example.json      # Example database configuration
└── LICENSE                     # MIT

Tech stack

  • Python 3 + Flask (web server)
  • Shapely (WKT geometry parsing)
  • psycopg2 (PostgreSQL connectivity)
  • Tianditu WebGIS (basemap tiles)
  • pywebview (optional desktop build)

License

MIT © Retter Wang

About

Scene boundary visualizer — filter, query and map scene boundaries across provinces and mobile network operators (Flask + Shapely + Tianditu) | 场景边界可视化查看器:多省份多运营商边界的筛选、查询与地图展示

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages