hk-area
v1.0.2
Published
Return the area (NT, Kowloon, HK, Island) of a given coorindates
Downloads
44
Readme
hk-area
Return the area (NT, Kowloon, HK, Island) of a given coorindates
🏠 Homepage
Install
npm install hk-area
yarn add hk-area
Example
import getHKArea from "hk-area";
let area = getHKArea(22.203350936422417, 113.86662909332935);
console.log(area); // HK
Methods
Summary
Details
getHKArea()
getHKArea(lat, long);
Parameters:
| Name | Type | Required | Description | | ---- | ------ | -------- | ------------------------------ | | lat | double | Yes | Latitude in WGS84 Coordinates | | long | double | Yes | Longitude in WGS84 Coordinates |
Run tests
yarn test
Data Source
The boundaries data is based on HKGov's Hong Kong Geodata Store, specifically the Boundary Plan of District Lands Office.
The original boundaries definition is too large (1.5MB after minified), for sake of performance and package size, the boundaries definition are simplified using mapshaper. Therefore, some locations near the edge of the area (particularly between NT and Kowloon) might not be accurate. But it's good enough for most of the use case.
All coordinates has been converted from HK1980 to WGS84 coordinates.
Author
Github: @alanho
License
This README was generated with ❤️ by readme-md-generator