HK Service Map is a map to visualise service units data from XML provided by the Hong Kong Social Welfare Department.
Map screen including hovering status bar in bottom-left with Leaflet.js.
Displaying detailed info in traditional Chinese with OpenLayers, change language by clicking the button with globe icon.
Page with a list of unresolved address, navigated to by clicking the barrier icon under the globe icon in map screen.
- Implementation in both OpenLayers and Leaflet.js;
- Can be run locally or with a web server;
- No API limit (Address lookup service by HK-OGCIO, map tiles by OSM, layering API by OpenLayers or Leaflet.js);
- Multilingual support (Additional language and field support can be added through editing
scripts/localise.js
); - Address correction with
override.csv
;
Check out 'getinfo-csharp' for a more featured and supported version of 'getinfo' script
- Download the source code here.
- Install
python3
andpip
from repositories or build from source. - Using
pip
, installgrequests
andxmljson
- Connect to the Internet and run
getinfo.py
usingpython3
(Heavy Internet traffic process) - Wait for the script to finish and open either
openlayers.html
orleaflet.html
depends on the preferred API.
Remove the following files before starting a public server:
- .eslintrc.yml
- .git*
- getinfo.py
- node_modules
- package*.json
- README.md
- requirements.txt
- screenshot-*.png
Basic Information and Service Quality Information of Residential Care Homes for the Elderly
Basic Information and Service Quality Information of Residential Care Homes for Persons with Disabilities
Target XML must follow this template for the map to work, <ANY/>
means a node with any tag can be placed here. count
attribute in tag means the tag can be repeated by count
times, otherwise only once is allowed, other attributes are mandatory. [abc here]
means insert the custom value denoted by abc
. Tags can contain any extra attributes.
<ANY xmlns="ANY">
<serviceUnits>
<serviceUnit count="Infinity">
<nameTChinese/>
<addressEnglish/>
<addressTChinese/>
<districtEnglish/>
<ANY count="Infinity"/>
</serviceUnit>
</serviceUnits>
</ANY>
With ANY
tag in serviceUnit
, scripts/localise.js
must be changed in order to display localised names, if no entry is added to the file, XML tag name will be parsed and displayed. If empty string is used in localised names, the associated property is skipped from displaying.
override.csv
is a tab separated value file of the following format:
[Traditional Chinese Name] [Proposed Address] [Longtitude Offset] [Latitude Offset] [Registered Address]
The file can be used either for replacing incorrect coordinates from address query or locating unresolved units with nearby landmark.
It regenerates automatically if removed, and add units with unresolved address to the file.
After changing override.csv
, getinfo.py
needs to be rerun.
[Traditional Chinese Name]
is used to identify the unit to modify.
[Proposed Address]
is the target approximated address to query for the unit, can be in any language that is recognised by HK-OGCIO API. If it is the string [NO OVERRIDE]
, the entry will be ignored.
[Longitude Offset]
is the longitude offset from the [Proposed Address]
.
[Latitude Offset]
is the latitude offset from the [Proposed Address]
.
[Registered Address]
is only for reference when the file is generated, and can be omitted.
Entries should not contain any lowercase letter before the first tab, as they are treated as comments and will be ignored.
Comments in override.csv
can disregard the tab separated value format, but it must have at least one lowercase character before the first tab character.
Comments should not be all lower snakecase as they are reserved to be used as option keys (e.g. xml_url
).
Allowed comment examples: This
, with space
, This with space
, Mixed_snakecase
, lower not snake UPPER
Disallowed comment examples: this
, snake_case
, UPPERCASE
, UPPER_SNAKECASE
, !@#$%^&*12345
, UPPER lower
Generation options are key value pairs separated by tab, like this: [Key] [Value]
Keys are in all lower snakecase, this is why comments have the naming restrictions.
xml_url
is the default URL used when no URL is provided at generation time.
batch_size
is the maximum amount of parallel request at a time for geospatial information (default: 50).