Skip to content

alanho/hk-area

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hk-area

NPM Version NPM Install Size NPM Downloads

Version

Return the area (NT, Kowloon, HK, Island) of a given coorindates

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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published