Chatbot × Spatial query × Open government data

Map-Click Lookup Chatbot

A resident selects a district from a menu in the chatbot or types a street address. The system looks up the coordinates of the address, determines the district and land use zone, and replies with the nearest metro station and the public-facility sites nearby. Administrators adjust the search radius and the note text through a separate web back end. This page uses open government data for the Zhongzheng, Datong, Wanhua and Da’an districts of Taipei City.

4 districtsZhongzheng, Datong, Wanhua and Da’an, Taipei City
5-section replyDistrict / land use zone / nearest metro station / nearby facilities / live water level and YouBike
3 query methodsMenu, typed address, typed name

Terms

Land use zone

Urban planning divides land into classes such as residential, commercial and industrial zones and park or school sites. Colors follow Annex 3 of the Ministry of the Interior’s Urban Plan Drawing and Document Guidelines.

Public-facility site marker

The centroid of a school, park, government or market site of 1,200 m² or more stands for that site and is used to count nearby sites.

Webhook

When a user sends a message, the chat platform sends the message content to a specified URL as a network request. The server processes it and then replies.

Problem

Before

  • To find the land use zone of a location and the metro stations and public-facility sites near it, a user has to check several map layers and systems separately.
  • Users usually know only the street address, not the district or zone it belongs to.
  • After a setting such as the search radius changed, no record of query counts was kept.

After

  • The chatbot replies with a four-section card, and the format is the same for every district.
  • After a user types an address, the system gets the coordinates from the address-point data and determines the district and zone from the boundary and zoning data.
  • Administrators adjust the radius and note text in the back end, which provides login verification and usage statistics export.

Workflow

1Receive and verifyMessages arrive through a webhook. The request signature is verified with the channel secret, and requests with a mismatched signature are not processed.
2Parse message typeThe message is classified as a menu selection or typed text; typed text is checked as a street address, a district name or a metro station name.
3Locate the address and determine the zoneThe address text is normalised (full-width digits, 台 and 臺, section numbers), matched against the address-point data to get coordinates, and tested against the district and land use zone polygons with a point-in-polygon check.
4Build the four-section cardThe nearest metro station and the number of nearby public-facility sites are calculated and assembled in a fixed order. When no address matches, a message with the expected format and similar street names is sent.
5Reply and logThe reply is sent, and an anonymous query record is written for back-end statistics and export.

Interactive demo: look up location information

Lookup chatbotMap data are open government data published by the Taipei City Government. Type a street address; the map marks its position.
Zhongzheng, Datong, Wanhua and Da’an districts, Taipei City (the circle marks the address queried)

No address queried yet.

Location lookup

Admin page illustration

Admin pageAfter editing, query again in the chat above to see the new settings
Editing requires login. This is a demo and is not connected to any real account.
Query counts during this browsing session
Total queries0
District determined0
Outside area or not found0

Legal basis for zone colors

The colors of land use zones and public-facility sites follow the R.G.B values in Annex 3 (Urban Plan Legends) to Point 7 of the Ministry of the Interior’s Urban Plan Drawing and Document Guidelines. Legends the annex does not define follow each urban plan’s own documents; this demo draws them in neutral grey. The full color table is on the Batch Thematic Map Export Tool page.

Source document: Ministry of the Interior, Urban Plan Drawing and Document Guidelines (都市計畫書圖製作要點), version of 29 January 2018, Annex 3 to Point 7. PDF: https://www.rootlaw.com.tw/Attach/L-Doc/A040040101047600-1070129-7000-001.pdf (checked 2026-11-23). This is a republished copy. The original was not retrieved from the National Laws and Regulations Database or the Ministry’s own site, and whether a newer version exists has not been confirmed.

Data sources and licenses

DatasetProviderLicenseUpdate date and coordinate system
Taipei City Urban Plan Land Use Zoning Map (detailed plan, polygons)
https://data.gov.tw/dataset/156197
Taipei City Government, Department of Urban DevelopmentOpen Government Data License, Version 1 (Taiwan)File "1150409細部計畫圖.zip"; DBF in the file dated 2026-04-09; dataset-page metadata updated 2026-10-13
TWD97 TM2 (EPSG:3826; the file has no .prj, so it was inferred from the coordinate range)
Taipei City Neighborhood Boundaries (dissolved into district boundaries)
https://data.gov.tw/dataset/121424
Taipei City Government, Department of Civil AffairsOpen Government Data License, Version 1 (Taiwan)DBF in the file dated 2026-09-21; dataset-page metadata updated 2026-10-13
TWD97 TM2 (EPSG:3826; .prj included)
Taipei Metropolitan Area Mass Rapid Transit System Route Map
https://data.gov.tw/dataset/121208
Taipei City Government, Department of Rapid Transit SystemsOpen Government Data License, Version 1 (Taiwan)Dataset-page metadata updated 2026-10-13; the file does not state a content date
EPSG:3826 (declared in the file)
Taipei Metropolitan Area Mass Rapid Transit System Station Points
https://data.gov.tw/dataset/121140
Taipei City Government, Department of Rapid Transit SystemsOpen Government Data License, Version 1 (Taiwan)Dataset-page metadata updated 2026-10-13; the file does not state a content date
EPSG:3826 (declared in the file)
Taipei City Address Point Data (used to locate addresses)
https://data.gov.tw/dataset/155472
Taipei City Government, Department of Civil AffairsOpen Government Data License, Version 1 (Taiwan)File dated 2026-11-02 (dataset updated monthly)
TWD97 TM2 (inferred from the coordinate range; the file states no CRS)
WRA real-time water level
https://data.gov.tw/dataset/25768
Water Resources Agency, Ministry of Economic AffairsOpen Government Data License, Version 1 (Taiwan)Dataset page says hourly; one reading every 10 minutes observed in testing. Read live in the browser, no key.
Unit: meters
River water-level station status (station coordinates)
https://data.gov.tw/dataset/22227
Water Resources Agency, Ministry of Economic AffairsOpen Government Data License, Version 1 (Taiwan)Dataset-page metadata updated 2026-10-16 (irregular updates). Only the 32 active stations around Taipei are kept.
TWD97 TM2
YouBike2.0 Taipei City Public Bicycle Real-Time Information
https://data.gov.tw/dataset/137993
Taipei City Government, Department of TransportationOpen Government Data License, Version 1 (Taiwan)Updated every minute. Read live in the browser, no key.
WGS84 latitude and longitude (converted to TWD97 in the page)
All datasets are published on the Taiwan Open Government Data platform and were downloaded on 2026-11-23. Coordinates stay in TWD97 TM2 (meters), geometry is simplified with a 2 m tolerance and rounded to whole meters, and only the Zhongzheng, Datong, Wanhua and Da’an districts are kept. Address lookup uses the Taipei City address-point dataset (124 MB, about 1.16 million rows). Only the four districts are kept, floor duplicates are removed, and 81,920 addresses are encoded into a 0.9 MB file loaded on the first query. When the exact address is missing, the nearest address on the same street is used. The nearest metro station is a straight-line distance, not a walking distance, and the facility counts are based on centroids and do not equal the actual number of facilities. Section 5 reads public URLs of the Water Resources Agency and the Taipei City Government from the browser, without a key. The address typed by the user is matched to coordinates in the browser only and is never sent. The water level is the reading at the nearest gauge, not at the address, and YouBike figures are live counts at the nearest stations. Live data are not official warnings and are for reference only. The replies on this page are a portfolio demonstration with no legal effect. Use the urban plan documents announced by the competent authority for actual zoning.

Outcome and technology

Fixed reply format

Each query is answered with a five-section card. The district, zone, nearest metro station, nearby facilities and live information always appear in the same positions.

Automatic address lookup

After a user types an address, the program gets its coordinates and determines the district and land use zone. When no address matches, a message with the expected format and similar street names is sent.

Administration and statistics

The admin page requires login and a verification code. It can adjust the radius and note text and export usage statistics.

PythonFlaskMessaging APIWebhook signature verificationGeoJSONAddress geocodingLive data APIPoint-in-polygon testCloud web service deploymentOpen government data