Civic Intelligence (民声智理) · 12345 Public Hotline Cognitive Engine & AI Workflow
Spatial computing, multi-tier administrative division mesh, and zero-drift GIS visualization standards.
- Executive Summary
- Multi-Tier Spatial Data Hierarchy
- Coordinate Reference Systems (CRS) & Pixel-Perfect Alignment
- Front/Back Separation Architecture for GIS
- Geo-Location in the AI Agent Pipeline
- Visualization & UX Ergonomics Standards
- API & Data Schema Reference
CivicRadar does not treat geographic maps as static UI decorations. Instead, spatial data is treated as an active dimension of incident reasoning and operational routing:
- Incident-to-Grid Binding: Translates unstructured conversational citizen reports into structured geographic coordinates and official 4th-level subdistrict grids (镇街/网格).
- Spatial Semantic Clustering: Merges micro-spatial entity proximity with LangGraph embeddings to identify localized recurring incident clusters (多频高发群组).
- High-Performance Vector Visualization: Provides subdistrict-level choropleths, centroid micro-badges, and zero-jank interactive filtering with full multi-tenant region switching.
Traditional municipal systems often stop at the 3rd administrative tier (District/County level, e.g., 顺德区 or 天河区). CivicRadar standardizes on the 4th statutory administrative level (Township/Subdistrict level, e.g., 大良街道, 容桂街道, 猎德街道):
- Shunde District (
fs_shunde): 10 official townships / subdistricts. - Tianhe District (
gz_tianhe): 21 official subdistricts.
All geographic boundary datasets follow the strict prefixed format in /public/civic/:
fs_shunde-townships.geojson(Foshan Shunde Subdistrict Mesh)gz_tianhe-townships.geojson(Guangzhou Tianhe Subdistrict Mesh)
To guarantee 100% rendering uptime regardless of database state or cold starts, boundary resolution employs a 3-tier cascade:
flowchart TD
A[Client Requests Boundary] --> B{Tier 1: Tenant Database?<br/>/api/regions/:id/boundary?level=subdistricts}
B -->|Found in public.regions| C[Render High-Precision GeoJSON]
B -->|Empty or Network Lag| D{Tier 2: Local Static Asset?<br/>/civic/:regionId-townships.geojson}
D -->|Asset Exists| C
D -->|Missing| E{Tier 3: District Fallback?<br/>/api/regions/:id/boundary?level=district}
E -->|Success| F[Render District Boundary Outline]
E -->|Failed| G[Display Graceful Fallback]
In the Chinese GIS ecosystem, map layers and GeoJSON often diverge across three incompatible coordinate standards:
| Coordinate System | Authority / Platform | Characteristics | Non-linear Encryption Shift |
|---|---|---|---|
| WGS-84 / CGCS2000 | National Geomatics Center of China (Tianditu), Gov GeoJSON | Standard geodetic ellipsoid | 0 meters (True Coordinates) |
| GCJ-02 ("Mars Coordinates") | AutoNavi (Amap), Google China, Tencent | Obfuscated via national algorithm | 300m ~ 500m offset |
| BD-09 | Baidu Maps | Secondary obfuscation on top of GCJ-02 | 400m ~ 800m offset |
CivicRadar strictly aligns its GeoJSON boundaries with Tianditu CGCS2000 base layers:
- Vector boundary coordinates and Tianditu raster tiles use the identical spatial reference.
- Zero offset: Rivers, highways, bridges, and subdistrict boundaries align down to the individual pixel.
┌────────────────────────────────────────────────────────────┐
│ Client Browser (Leaflet) │
└──────┬─────────────────────────────────────────────┬───────┘
│ │
│ ① Map Raster Tiles (High-frequency images) │ ② Administrative Boundaries & Geocoding
│ Cached locally via HTTP Disk Cache │ (Low-frequency business data)
▼ ▼
┌────────────────────────────┐ ┌────────────────────────────┐
│ Tianditu / Tile Proxy │ │ Next.js Server Backend │
│ (256x256 WMTS Png Layers) │ │ (/api/regions, /api/map) │
└────────────────────────────┘ └─────────────┬──────────────┘
│
│ ③ TIANDITU_SERVER_KEY
▼
┌────────────────────────────┐
│ Tianditu National API Gate │
│ (Reverse Geocoding / POIs) │
└────────────────────────────┘
- Map Tile Delivery:
- Vector and annotation tiles are requested through
/api/map/tile?type=vecand/api/map/tile?type=cva. - The backend proxy injects statutory user-agent headers and enforces
Cache-Control: public, max-age=604800(7 days). - Once fetched, tiles are served entirely from the client browser's
disk cache, resulting in zero ongoing compute or network overhead on the application server.
- Vector and annotation tiles are requested through
- Backend Key Security:
TIANDITU_SERVER_KEYis maintained exclusively within server-side environment variables (.env.local,.env.vps) and is never exposed in client bundles or network inspection.
Spatial intelligence directly feeds the LangGraph multi-stage graph pipeline:
Raw citizen descriptions frequently contain erratic micro-suffixes:
"大良街道金榜上街28号门前沿街商铺"➔ Cleansed to:"大良街道金榜上街""容桂文武路某烧烤档夜间占道"➔ Cleansed to:"容桂文武路"
By stripping away room numbers, floor levels, and generic suffixes while preserving road, neighborhood, and village cores, the system ensures high-quality clustering keys.
When a citizen ticket omits explicit subdistrict metadata:
- The AI pipeline evaluates the spatial description against canonical landmark and community dictionaries in
lib/vocabulary.ts. - References such as
"清晖园门前"or"太古汇北门"automatically map to their statutory subdistricts (大良街道 and 天河南街道). - Tickets without geographic markers remain unassigned rather than being assigned arbitrary defaults.
To prevent over-clustering:
- Distinct road sections within the same town are evaluated as distinct spatial nodes.
- Administrative-level generalities (e.g., merging all
"大良街道"tickets into one) are strictly blocked byRULES.adminOnlyLocation.
- Single Source of Truth (SSOT) Palette:
- Township colors are centrally derived via
getTownshipColor(name)inlib/civic-cluster.ts. - The exact same color corresponds to a given subdistrict across GIS choropleth maps, ticket tables, trend charts, and vocabulary administration settings.
- Township colors are centrally derived via
- Centroid Micro-Badge Anchoring:
- Dynamic HTML markers that drift during zoom have been eliminated.
- The
[Township Name · Ticket Count]pill is permanently bound to the polygon's geometric centroid.
- Zero-Jank Interaction:
- Selecting a township highlights the polygon and filters the dashboard while preserving the exact viewport and zoom level.
vector-effect: non-scaling-stroke !important;prevents stroke explosion artifacts during map zooms.
ALTER TABLE public.regions
ADD COLUMN IF NOT EXISTS geojson_boundary text, -- District Level Boundary
ADD COLUMN IF NOT EXISTS subdistricts_geojson text; -- 4th-Level Subdistrict Mesh| Method | Route | Description |
|---|---|---|
GET |
/api/regions/:id/boundary?level=subdistricts |
Retrieves 4th-level subdistrict polygon mesh |
GET |
/api/regions/:id/boundary?level=district |
Retrieves 3rd-level district outline polygon |
POST |
/api/map/geocode |
Bi-directional geocoding & subdistrict reverse lookup |
GET |
/api/map/tile?type=vec&z=:z&x=:x&y=:y |
High-speed cached Tianditu vector raster tile proxy |
GET |
/api/map/tile?type=cva&z=:z&x=:x&y=:y |
High-speed cached Tianditu annotation tile proxy |
To ensure municipal administrative assets and civic intelligence services are machine-readable across web crawlers and modern AI search engines:
- Schema.org Integration: The platform dynamically injects
GovernmentServiceandSoftwareApplicationJSON-LD schemas in the root layout, linking statutory administrative subdistricts (佛山市顺德区,广州市天河区) directly to civic analytics operations. - Geographic HTML Directives: Emits standard RFC geographic metadata:
<meta name="geo.region" content="CN-GD" /> <meta name="geo.placename" content="Guangdong" /> <meta name="geo.position" content="22.80;113.29" /> <meta name="ICBM" content="22.80, 113.29" />
In accordance with modern LLM search agent standards (Anthropic, OpenAI, Perplexity):
- High-Density Manifest:
/public/llms.txtexposes canonical system architecture, System-1/2 dual-engine specs, Tianditu CGCS2000 standards, and core API endpoints in clean Markdown. - Zero-Drift Spatial Discovery: AI search bots indexing the platform immediately resolve official 4th-level subdistrict coverage and Model Context Protocol (MCP) tool bindings without hallucinations.
app/robots.ts: Provides strict crawl policy allowing public spatial overviews, themes, andllms.txtwhile shielding sensitive administrative/admin/and/mcp/authorizepaths.app/sitemap.ts: Next.js 15 metadata route registering high-frequency municipal analytics routes with prioritized crawl frequencies.