Skip to main content

Utilities for working with Placekeys

Project description

Placekey-py

A Python library for working with Placekeys. Documentation for this package can be found here, and documentation for the Placekey service API can be found here.

Usage

The basic functionality of the Placekey library is conversion between Placekeys and latitude-longitude coordinates.

>>> import placekey as pk
>>> lat, long = 0.0, 0.0
>>> pk.geo_to_placekey(lat, long)
'@dvt-smp-tvz'
>>> pk.placekey_to_geo('@dvt-smp-tvz')
(0.00018033323813810344, -0.00018985758738881587)

The library also allows for conversion between Placekeys and H3 indices.

>>> pk.placekey_to_h3('@dvt-smp-tvz')
'8a754e64992ffff'
>>> pk.h3_to_placekey('8a754e64992ffff')
'@dvt-smp-tvz'

The distance in meters between two Placekeys can be found with the following function.

>>> pk.placekey_distance('@dvt-smp-tvz', '@5vg-7gq-tjv')
12795124.895573696

An upper bound on the maximal distance in meters between two Placekeys based on the length of their shared prefix is provided by placekey.get_prefix_distance_dict().

>>> pk.get_prefix_distance_dict()
{0: 20040000.0,
 1: 20040000.0,
 2: 2777000.0,
 3: 1065000.0,
 4: 152400.0,
 5: 21770.0,
 6: 8227.0,
 7: 1176.0,
 8: 444.3,
 9: 63.47}

Placekeys found in a data set can be partially validated by

>>> pk.placekey_format_is_valid('222-227@dvt-smp-tvz')
True
>>> pk.placekey_format_is_valid('@123-456-789')
False

Notebooks

Jupyter notebooks demonstrating various Placekey functionality are contained in the placekey-notebooks repository.

Support

This package runs on Python 3.

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

placekey-0.0.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

placekey-0.0.1-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file placekey-0.0.1.tar.gz.

File metadata

  • Download URL: placekey-0.0.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.3

File hashes

Hashes for placekey-0.0.1.tar.gz
Algorithm Hash digest
SHA256 47f7181d87f8ca6617e946819612e9eaf2e8c40d9dc3680e7679059850a4f7f2
MD5 59dea48e1d0c724fd5254332f241b18b
BLAKE2b-256 ab96b29def96834a5bd60012dbe23bc4baea2c313290b6f541fb63afb162aabd

See more details on using hashes here.

File details

Details for the file placekey-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: placekey-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.3

File hashes

Hashes for placekey-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5f85fec7435060913d06c75b653668aa96e7ed149f1813cd34f1191b6bdf7580
MD5 a1be77c5097b0dc43a06253cf76ce28c
BLAKE2b-256 b2c3d7f6fd4a188050f69b39289f119d9d5a100beccd820b6e99e3374ff743b9

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