hk-area

1.0.2 • Public • Published

hk-area

NPM Version NPM Install Size NPM Downloads

Version

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

License: MIT


This README was generated with ❤️ by readme-md-generator

Readme

Keywords

none

Package Sidebar

Install

npm i hk-area

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

45 kB

Total Files

7

Last publish

Collaborators

  • alanbho