Skip to main content

A forked project from hk80. This project also convert the coordinates between Hong Kong 1980 Grid System and World Geodetic System 1984 with pyproj, with a more update version of pyproj and providing better performance.

Project description

hk1980

A forked project from hk80. This project also convert the coordinates between Hong Kong 1980 Grid System and World Geodetic System 1984 with pyproj, with a more update version of pyproj and providing better performance.

Installation

Use the package manager pip or poetry to install foobar.

pip install hk1980

or

poetry add hk1980

Usage

from hk1980 import LatLon, HK80

hku = LatLon(22.284034, 114.137814).to_hk80()
print(hku.northing, hku.easting) # 836303.204 818195.94
print(hku.x, hku.y) # 818195.94 836303.204

hku = HK80(northing=816128, easting=832243).to_wgs84()
print(hku.latitude, hku.longitude) # 22.42944514 113.98124272
print(hku.x, hku.y) # 113.98124272 22.42944514

Performance

hk1980 is roughly well performant than hk80 than 238 times.

#hk80
import timeit
stmt = "LatLon(22.284034, 114.137814).to_hk80()"
_time_ms = timeit.timeit(stmt=stmt, globals=globals(), number=100)*1000
print(f"time: {_time_ms} ms") # 238.1038 ms

#hk1980
import timeit
stmt = "LatLon(22.284034, 114.137814).to_hk80()"
_time_ms = timeit.timeit(stmt=stmt, globals=globals(), number=100)*1000
print(f"time: {_time_ms} ms") # 1.0652 ms

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hk1980-0.2.3.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hk1980-0.2.3-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file hk1980-0.2.3.tar.gz.

File metadata

  • Download URL: hk1980-0.2.3.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.13.3 Darwin/24.1.0

File hashes

Hashes for hk1980-0.2.3.tar.gz
Algorithm Hash digest
SHA256 4879e351eea430a327c89bff596c2ba4c865ba6193b06a44243aab645f8895a6
MD5 2260a4617de4338489d3c0120ef90a0c
BLAKE2b-256 f4123f8ea5d07e0bb131257c0b930a1fef42faa13aaf3d1bcf4f3f309a7738b9

See more details on using hashes here.

File details

Details for the file hk1980-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: hk1980-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.13.3 Darwin/24.1.0

File hashes

Hashes for hk1980-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6bb83ce0790dba289529c75793e742eeb310fa21ccdac1fc96ab2fddfcb6124f
MD5 ef206270ab18b50d0338609508dbac71
BLAKE2b-256 2b0da3c1cee3495cd3fdca5a4f20c45b7f132b02ab9e8c799896aa3bb3e518ca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page