Skip to main content

Simple plus code to lat/long decoder written for White Flag Project

Project description

pluscodepy

Simple plus code to lat/long decoder written for White Flag Project.

Quickstart

  1. pip install pluscodepy
  2. converter = pluscodepy.Converter('places.json')
  3. latitude, longitude = converter.decode('GM83+2X Skudai, Johor')

Install

pip install pluscodepy

Usage

Parameters

__init__(filename: str)

filename: str Name/path to file the json containing a place index. If none exists, one will be created.

decode(pluscode: str)

pluscode: str Plus code to be decoded.

Return

Union[(float, float), False] Returns a float of tuples representing latitude and longitude OR returns false if the pluscode cannot be decoded.

How it works

The converter makes use of the Google Open Location Code library to decode and works with both full code and short code. The converter will try to work offline whenever possible.

If the input is a full code, it will just decode without any preprocessing. If a place string is detected in the code, it'll first check for the place's lat/long in the index file, and convert that to the 4 digit prefix. If the place is not yet indexed, it'll search on the Nominatim OSM API and index valid result's lat/long into the index file for future use. And then the lat/long values are returned as a tuple (latitude, longitude).

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

pluscodepy-0.0.10.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

pluscodepy-0.0.10-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file pluscodepy-0.0.10.tar.gz.

File metadata

  • Download URL: pluscodepy-0.0.10.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.2

File hashes

Hashes for pluscodepy-0.0.10.tar.gz
Algorithm Hash digest
SHA256 6ea1ba8d6fd1b1d01a53d6c248bd4ed1097376dca0695cb5d1fd9a9d4d7ca654
MD5 11b28fd24080389b9750950cd2d1960b
BLAKE2b-256 2bed97c634c58632209d40f1c4f55b7f0eda3e92ee749f131951f84aa9a4dd0f

See more details on using hashes here.

File details

Details for the file pluscodepy-0.0.10-py3-none-any.whl.

File metadata

  • Download URL: pluscodepy-0.0.10-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.8.2

File hashes

Hashes for pluscodepy-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 f583e503c9bd03abe8ed72709249c90121137e1e7bbe017a7007e89c79837fa7
MD5 e8be9028668850f377bb73c4516f999b
BLAKE2b-256 ef0aad7ab67a0d7bead00f645a7a21ada0def8ad50e6aaee429015a444bc515a

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